如何识别Internet Explorer中的最后一个ondocumentcomplete? [英] How to identify last ondocumentcomplete in Internet Explorer?

查看:114
本文介绍了如何识别Internet Explorer中的最后一个ondocumentcomplete?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在C Sharp中开发一个IE工具栏,可以访问IE中显示的html源页面并进行处理。我依赖于ondocumentcomplete事件处理程序。触发时,会获取html源代码。但是我的页面有框架有问题,因为ondocumentcomplete是针对每个帧触发的,最后一个是外框,窗口。为了解决这个问题,我确实喜欢这个 -

Hi,
I am developing an IE toolbar in C Sharp that accesses the html source of page displayed in IE and process it. I'm relying on the ondocumentcomplete event handler. When it is fired, the html source is taken. But I have a trouble with pages having frames since ondocumentcomplete is fired for each frame, the last being the outer frame, the window. In order to tackle this I did like this -

public void OnDocumentComplete(object pDisp, ref object URL)
{
  if (pDisp.Equals(Explorer.IWebBrowser_Parent))
    {
         // check for frames n get the source of all
    }
  else
        // ignore
 }



像这样,我能够获得最后一个ondocumentcomplete事件,然后获取所有帧的来源。但问题是对于某些具有框架或iframe的页面,不会为窗口触发ondocumentcomplete。因此上述代码不会处理任何此类代码,例如 - http://www.w3schools.com/html/tryit .asp?filename = tryhtml_intro [ ^ ]触发该URL的ondocumplete,但是点击编辑并单击我按钮虽然重新加载了框架,但没有触发ondocumentcomplete为窗口。如何解决这个问题?



谢谢,

Arun


Like this I was able to get the last ondocumentcomplete event and then get the source of all the frames. But the problem is for certain pages that have frame or iframe, ondocumentcomplete is not fired for the window. so the above code would not process any such e.g - http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro[^] fires an ondocumplete for that url, however clicking on 'edit and click me' button though reloads the frame, doesnt fire ondocumentcomplete for the window. How to work around this?

Thanks,
Arun

推荐答案

看看这个链接。它还有一些非常好的示例来源:

http://happynomad121.blogspot.com/2009/09/listening-to-html-events-from-bho.html [ ^ ]



祝你好运!
Have a look at this link. It also has some very good example source:
http://happynomad121.blogspot.com/2009/09/listening-to-html-events-from-bho.html[^]

Good luck!


感谢Nijboer的回应。我得到了解决方案。它在 http://support.microsoft.com/kb/q180366/ [ ^ ]



问我们比较第一个navigationcomplete2触发的每个文档完成。
Thanks for the response Nijboer. I got the solution. Its mentioned clearly in http://support.microsoft.com/kb/q180366/[^]

Asks us to compare the first navigatecomplete2 fired with each documentcomplete.


URL是https://support.microsoft.com/en-us/kb/180366
The URL is https://support.microsoft.com/en-us/kb/180366


这篇关于如何识别Internet Explorer中的最后一个ondocumentcomplete?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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