检测web浏览器完成页面加载 [英] Detect WebBrowser complete page loading
问题描述
我如何检测时System.Windows.Forms.WebBrowser控件加载完成?
How can I detect when a System.Windows.Forms.WebBrowser control has completed loading?
我试图使用导航和DocumentCompleted事件,但他们两个文件加载过程中提出的几十倍!
I tried to use the Navigate and DocumentCompleted events but both of them were raised a few times during document loading!
推荐答案
我觉得 DocumentCompleted
活动将被解雇该加载以及所有子文件(如JS和CSS,例如)。你可以看一下 WebBrowserDocumentCompletedEventArgs
在 DocumentCompleted
和查询的网址财产和比较,为主页的网址。
I think the DocumentCompleted
event will get fired for all child documents that are loaded as well (like JS and CSS, for example). You could look at the WebBrowserDocumentCompletedEventArgs
in DocumentCompleted
and check the Url property and compare that to the Url of the main page.
这篇关于检测web浏览器完成页面加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!