I am attempting to write an Inter开发者_高级运维net Explorer (IE8) plugin using SpicIE (http://archive.msdn.microsoft.com/SpicIE). Inside the OnDocumentComplete method, I am able to access the HTML of the page by doing the following:
private static void SamplePlugin_OnDocumentComplete(object pDisp, ref object url){
SHDocVw.IWebBrowser2 browser = HostInstance.BrowserRef as SHDocVw.IWebBrowser2;
mshtml.HTMLDocument htmlDocument = browser.Document as mshtml.HTMLDocument;
String html = htmlDocument.documentElement.outerHTML;
}
My problem is, some (most) pages have additional calls back to the server after the initial page is loaded. How can I access the "rendered" HTML of the final page displayed to the user? For example, one site I'm looking at loads, then has AJAX calls that fill DIVs with text. But when I use the code above, I am not getting this text. I am getting the page before the dynamic content is loaded. Any ideas??
I really appreciate it, thanks!!
With IE8 this is a nearly impossible task since it doesn't support mutation events.
You need mutation events to detect changes made to the DOM (and this is exactly what happens when AJAXed info is added to the page). So your only chance is to do some kind of polling to detect changed elements, but this will have a noticable performance impact. Sorry.
精彩评论