开发者

How to get complete HTML body using browser helper object (BHO) in case of DHTML/AJAX page?

开发者 https://www.devze.com 2023-01-08 18:21 出处:网络
I\'m writing a BHO that analyze the HTML taken from the \'onDocumentComplete\' event of \'DWebBrowserEvents2\'. Currently it works fine, unless I have a DHTML/AJAX page, where HTML handle is delivered

I'm writing a BHO that analyze the HTML taken from the 'onDocumentComplete' event of 'DWebBrowserEvents2'. Currently it works fine, unless I have a DHTML/AJAX page, where HTML handle is delivered too soon.

For sample, I tried using it on 'http://www.google.com'. From the 'onDocumentComplete' event I can get most of the page but in the topmost link/anchors, the 'href' for maps, videos, orkut etc. is not available (normally it is javascript:void(0)).

Has anyone any ideas how to capture it when the page is fully loaded rather than just when the frame/body is loaded?

Thanks,

UPDATE

It see开发者_开发技巧ms there is some problem with the MSHTML API. I have posted the same question on MSDN forum and some response. Also I have detailed out my problem and findings....

http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/d517dbd1-df22-4dce-8ff9-0ca6786757f9

In case someone finds some way to solve this then please do share...

Thanks,


The AJAX DHTML changes mostly don't cause a further onDocumentComplete call.

You need to register for further Window or Document events such as DISPID_HTMLWINDOWEVENTS2_ONLOAD.

One method is to advise the window of a com object that you provide with the generic event sink interface. hr = AtlAdvise(winDisp, pWinHandler, DIID_HTMLWindowEvents2, &dwCookie);

When this further event is triggered re examining the document you will find that it is updated.

0

精彩评论

暂无评论...
验证码 换一张
取 消