Question

I'm building a browser extension which needs to collect all the HTML on a given page before passing it to background.js

extension.js code looks like this (partial code obviously):

appAPI.ready(function($) {
     var html = $('html').html();

...

It works perfectly on very simple test pages, however on some pages it's not collecting the correct HTML, it's hard to work out exactly what it's doing but I think it's collecting the contents of iFrames (and somehow social share buttons?).

What can I do to prevent this?

Was it helpful?

Solution

In general, the code snippet provided should do the trick. I suspect the results you are seeing is because you have enabled the Run in Iframes feature on the General Settings page and hence grabbing iframe information as well. If this is not the case, if you provide the extension id I can take a look and try and assist you further.

[Disclosure: I am a Crossrider employee]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top