如何在发生DHTML / AJAX页面使用的浏览器辅助对象(BHO),以获得完整的HTML身体?浏览器、对象、身体、完整

2023-09-10 17:06:32 作者:心软是病,可你是命

我正在写一个BHO的分析从拍摄的HTMLonDocumentComplete事件DWebBrowserEvents2 。目前,它工作正常,除非我有一个 DHTML / AJAX 页,HTML手柄传递的太快了。

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.

有关样品,我尝试使用它http://www.google.com。从onDocumentComplete事件,我可以得到大部分的页面,但在最上面的链接/锚,在HREF的地图,视频,orkut的等无法使用(通常是 的javascript:无效(0) )。

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?

谢谢

更新

这似乎有一些问题与MSHTML API。我已经张贴在MSDN论坛和一些反应了同样的问题。此外,我有详细的出我的问题和发现......

It seems 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...

谢谢

推荐答案

AJAX的DHTML的变化几乎不造成进一步 onDocumentComplete 电话。

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

您需要注册更多窗口或文档事件,如 DISPID_HTMLWINDOWEVENTS2_ONLOAD

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

一种方法是建议您提供与通用的事件接收器接口的COM对象的窗口。 HR = At​​lAdvise(winDisp,pWinHandler,DIID_HTMLWindowEvents2,和放大器; dwCookie);

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.

 
精彩推荐
图片推荐