An error has occurred in the script WebBrowser WinForm

Allow System.Windows.Forms.WebBrowser to run javascript

How can I get the WebBrowser control to show modern contents?

The WebBrowser control uses the same Internet Explorer version which is installed on your OS but it doesn’t use the latest document mode by default and shows content in compatibility mode.

As a symptom, you can see the site in Internet Explorer, but WebBrowser control doesn’t show the site correctly and for some sites it shows script error too.

Solution

You can tell the WebBrowser control to use the latest document mode without compatibility mode in WebBrowser control. You can follow instructions here to disable the setting using registry.

Here is the settings which I used. I applied settings in HKEY_CURRENT_USER to make it work:

registry-key-of-type-REG_DWORD

and this values:

Don’t forget vshost.exe. Whrn you run your program in Visual Studio you need it.

It make the browser control use Internet Explorer 11 so Webpages are displayed in IE11 edge mode, regardless of the declared !DOCTYPE directive. Failing to declare a !DOCTYPE directive causes the page to load in Quirks.

To create entries right click on an empty area of the right pane, then in the window which appears after selecting dword value, choose hexadecimal and enter 2af9

Web site ok.

WebBrowserOK

An error has occurred in the script WebBrowser WinForm
4 (80%) 1 vote[s]