while (webBrowser1.ReadyState != WebBrowserReadyState.Complete || webBrowser1.IsBusy)
{
Application.DoEvents();
}
At somepages this pease og code returns even if the page has not finished loading. My guess it has something todo withpages waiting for javascripts. Is there a way to ensure that there is no more navigating?
On forehand thx.
Thomas Segato |
| Segato Thursday, July 27, 2006 7:22 AM |
DocumentCompleted should only be raised once when it really is completed.Navigating event will be fired for every frame though. Do you have an example ofa site that gives multiple DocumentCompleted events?
WebBrowser wb = new WebBrowser(); wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(DocumentCompletedHandler); wb.Navigate("http://forums.microsoft.com/msdn");
private void DocumentCompletedHandler(object sender, WebBrowserDocumentCompletedEventArgs e) { //Done! }
|
| Andreas Johansson Monday, July 31, 2006 9:00 PM |
The proper way would be to handle the DocumentCompleted event instead of looping for the proper state. |
| Andreas Johansson Sunday, July 30, 2006 2:26 AM |
Hi Thx for your reply. Can you show a code snippet? When do you know its the last Document_Completed? Most sites raises 5-10 document completed.
On forehand thx.
Thomas |
| Segato Sunday, July 30, 2006 8:02 AM |
DocumentCompleted should only be raised once when it really is completed.Navigating event will be fired for every frame though. Do you have an example ofa site that gives multiple DocumentCompleted events?
WebBrowser wb = new WebBrowser(); wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(DocumentCompletedHandler); wb.Navigate("http://forums.microsoft.com/msdn");
private void DocumentCompletedHandler(object sender, WebBrowserDocumentCompletedEventArgs e) { //Done! }
|
| Andreas Johansson Monday, July 31, 2006 9:00 PM |
Hi and thx for your reply,
DocumentCompleted will be fired after every redirection. Check http://www.flybillet.dk. So this solution is not that good. But thanks anyway.
Best regards
Thomas |
| Segato Tuesday, August 01, 2006 6:17 AM |
Hi there.
How would you explain the fact that when DocumentComplete is raised, even if I have a full Microsoft news email page loaded into my WebBrowser, webbrowser1.DocumentText is only "<HTML></HTML>" ??
(I load the HTML contents from a localMHT file) |
| smoothcoder Wednesday, August 23, 2006 9:36 AM |
This was driving me crazy.
I was trying to post data like this:
Code Snippet
WebBrowser browser = new WebBrowser();
browser.DocumentCompleted +=new WebBrowserDocumentCompletedEventHandler(handler);
browser.Navigate("<url>","<windowname>",<data>,"Content-Type: application/x-www-form-urlencoded");
and the DocumentComplete event would never fire.
so then I tried:
Code Snippet
browser.Navigate("www.google.com")
and the event fired.
Turns out if you name the window it won't fire, but if you do:
Code Snippet
browser.Navigate("<url>",null,<data>,"Content-Type: application/x-www-form-urlencoded");
|
| a__ryan___ Thursday, October 16, 2008 11:04 PM |