Detecting when a webpage is fully loaded using a C # webbrowser control

I use a control WebBrowser, there is an event called DocumentCompleted, this event is fired for every frame on the web page, as well as for all child documents (e.g. JS and CSS) that are loaded.

my question is how to determine the last record of this event, I mean how to determine when the page is fully loaded and this event no longer fires.

I searched a lot, I found a solution like this:

void webBrowser1_DocumentCompleted(object sender,
        WebBrowserDocumentCompletedEventArgs e)
{
    if (e.Url.Equals(webBrowser1.Url)) {
        // Here the page is fully loaded        
    }
}

but this does not work with all urls!

Does anyone have an idea how to achieve this?

thanx in advance

+2
source share
1 answer

DocumentComplete . HTML DOM window.onload . .

OTOH, AJAX. , , , 100% - . , , .

+2

All Articles