Why is WebBrowser_DocumentCompleted() firing twice?

前端 未结 9 1325
独厮守ぢ
独厮守ぢ 2020-11-29 08:35

Well, I\'m using a simple webbrowser control to browse to a page, so I need to change the Text of the form while doing so. I\'m using -

private void webBrow         


        
9条回答
  •  -上瘾入骨i
    2020-11-29 09:10

    Every time a frame loads, the event is fired.

    Also, before you even go there, the IsBusy property will only be True whilst the first frame has not loaded.

    void BrowserDocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
      if (e.Url.AbsolutePath != (sender as WebBrowser).Url.AbsolutePath)
        return; 
    
      //The page is finished loading 
    }
    

提交回复
热议问题