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:
HKEY_CURRENT_USER\Software\Microsoft\ Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
and this values:
"WindowsFormsApplication5.exe"=dword:00002af9 "WindowsFormsApplication5.vshost.exe"=dword:00002af9
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.