在 DHTML/AJAX 页面的情况下,如何使用浏览器辅助对象 (BHO) 获取完整的 HTML 正文?

发布于 2024-09-10 17:50:45 字数 856 浏览 8 评论 0原文

我正在编写一个 BHO,用于分析从 'DWebBrowserEvents2''onDocumentComplete' 事件中获取的 HTML。目前它工作正常,除非我有一个 DHTML/AJAX 页面,其中 HTML 句柄传递得太快。

例如,我尝试在 'http://www.google.com' 上使用它。通过 'onDocumentComplete' 事件,我可以获取大部分页面,但在最顶部的链接/锚点中,地图、视频、orkut 等的 'href' 不可用(通常是 javascript:void(0))。

有谁知道如何在页面完全加载时而不是仅在加载框架/正文时捕获它?

谢谢,

更新

MSHTML API 似乎存在一些问题。我已经在 MSDN 论坛上发布了同样的问题并得到了一些回复。我还详细说明了我的问题和发现...

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

万一有人找到某种方法来解决那么请分享...

谢谢,

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

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

热鲨 2024-09-17 17:50:45

AJAX DHTML 更改大多不会导致进一步的 onDocumentComplete 调用。

您需要注册进一步的窗口或文档事件,例如 DISPID_HTMLWINDOWEVENTS2_ONLOAD

一种方法是建议您使用通用事件接收器接口提供的 com 对象的窗口。
hr = AtlAdvise(winDisp, pWinHandler, DIID_HTMLWindowEvents2, &dwCookie);

当触发此进一步事件时,重新检查文档,您会发现它已更新。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文