Question

I am using the .net compact framework webbrowser control on a Windows CE device. The .Net application has a web server running on the device under a different thread. The webbrowser interacts with the web server as per normal browser functionality. The problem is that when pages are requested the screen does not always display until there is some browser event.

An example is if I put a Javascript alert(...) statement within the page's script. The screen will blank and the message will display and when you click the ok the full page displays

Another example is the page goes blank when the user navigates. Click anywhere on the screen and the page will display.

It seems as if the pages are loading but the webbrowser control is locked and will not display anything until there is a user event.

DocumentCompleted() event does fire, within that event I have tried

        webBrowser.Invalidate();
        webBrowser.Update();
        webBrowser.Refresh();

But the page will not display until the user taps the screen with the stylus.

Was it helpful?

Solution 2

Use the DocumentCompleted event of the WebBrowser control, like this:

private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    // hack for Windows CE based devices in order to get the page load right
    webBrowser.Width--;
    webBrowser.Width++;
}

OTHER TIPS

Figuring that an event was required in order to get the code to display I put this code at the end of the page load.

setTimeout(function(){
window.scrollTo(0,0);
}, 1);

That resolved the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top