I'm writing an extension for Google Chrome that converts a page to a PDF.
To do this, I download the DOM of the page and pass it to a software that further converts the webpage to a PDF. Since only the DOM is passed, the software downloads the various other resources, like CSS, images, etc.
The software is not allowed to access secured resources, i.e. located at URLs beginning with https://. These resources are downloaded separately in the (NPAPI) DLL that interacts with the JavaScript, by using XMLHttpRequest.
This approach works fine for pages that don't have HTTPS frames. To extend this functionality to work for HTTPS frames, I need to download their DOM, images and CSS, and so on for each nested frame. How do I do this?
If you're using a content script to capture the DOM, it should be as easy as injecting the capturing code into all the frames:
chrome.tabs.executeScript(tabId, { code:code, allFrames:true});
Then have the message passing function also pass back window.location
and cross-reference that with the src="..."
attribute on all the frames.