C# .NET - Webbroser control fails for certain web sites

Asked By Rolf Keller on 05-Oct-14 12:16 PM

I wrote an C# application that uses the .NET WebBrowser control. The following code demonstrates the problem: Its is possible to navigate through that web site, but the ALL button on the left side of the blue menu bar doesn't work.
I tried Net 2.0 and 3.5 on Vista 64, and I also tried the AxWebBrowser control.

Strange enough, this very website works via MS Internet Explorer 9 on this very PC.
Any idea how I can my application get working? I DO need that.

// Begin of example
using System;
using System.Threading;
using System.Windows.Forms;

internal class Global
{
[System.STAThreadAttribute()]
internal static void Main(string[] args)
{
Form myForm = new Form();
myForm.Width = myForm.Height = 800;

WebBrowser myBrowser = new WebBrowser();
myForm.Controls.Add(myBrowser);
myBrowser.Size = myForm.ClientSize;

myForm.Show();

myBrowser.ScriptErrorsSuppressed = true; // Problem persists if this line is omitted
myBrowser.Navigate("http://www.oxforddictionary.com");

while (true) { System.Windows.Forms.Application.DoEvents(); Thread.Sleep(50);  }
}
} // End of example

Robbe Morris replied to Rolf Keller on 05-Oct-14 02:30 PM
Look deep in the JavaScript.  It is probably using JSON or Jquery and that likely won't run properly in the web browser control(s).
Rolf Keller replied to Robbe Morris on 10-Oct-14 04:25 AM
Thanks, Robbe!
In the meantime I found the solution. The WebBrowser control is a wrapper for the installed IE, but by default it is set to "IE 7 compatible".  Microsoft knows, why.    :-(
So one has to set the WebBroser control to a higher version, preferably to the version of the installed IE.
See http://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
Robbe Morris replied to Rolf Keller on 10-Oct-14 07:14 AM
Ya know I could never get that to work.  The more problematic thing was suppressing javascript errors.  I ended up having to go back to Windows Forms .NET instead of WPF for that very reason.  I also like Awesomium for taking web page screen shots.