質問

From a BHO (Browser Helper Object) in Internet Explorer, how do I get the full source code of the page currently loaded in the web browser when I have its IWebBrowser2 interface?

Do I have to download it again from the url where it resides or is there a way to get the copy that internet explorer downloaded and used to render the page?

I tried getting the outerHTML of the html element of the current document, but it returns the source code already preprocessed. I need to get it in the same form you see it when you clock "View Source Code" in the Internet Explorer.

Thank you for any helpful information!!!

役に立ちましたか?

解決

You can query the browser's Document property for IPersistStream or IPersistFile and then call its Save() method. But when querying the browser for its HTML, you are likely to get the processed HTML, which may include DOM changes from scripts.

To get the original HTML, you should download it yourself directly from the source URL, or at least extract the file from the browser's local cache.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top