在 DHTML/AJAX 页面的情况下,如何使用浏览器帮助程序对象 (BHO) 获取完整的 HTML 正文? [英] How to get complete HTML body using browser helper object (BHO) in case of DHTML/AJAX page?

查看:29
本文介绍了在 DHTML/AJAX 页面的情况下,如何使用浏览器帮助程序对象 (BHO) 获取完整的 HTML 正文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 BHO,它分析从 'DWebBrowserEvents2''onDocumentComplete' 事件中获取的 HTML.目前它工作正常,除非我有一个 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' 事件中,我可以获得大部分页面,但在最顶部的链接/锚点中,地图、视频、orkut 等的 'href' 不可用(通常是 javascript:void(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 = AtlAdvise(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.

这篇关于在 DHTML/AJAX 页面的情况下,如何使用浏览器帮助程序对象 (BHO) 获取完整的 HTML 正文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆