开发者

how to determine when page is loaded completely in webbrowser control in csharp?

Hi Im 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 outter 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
     }

Like thi开发者_开发问答s i was able to 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?


The question seems to be: How do I know when I stop receiving data from my request?

If you phrase it like that, you may be able to apprehend when you do, aka, you are not getting any more data (set up a timer to check for that), or the connection to the page closes, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜