Allow System.Windows.Forms.WebBrowser to run javascript

Set the property ScriptErrorsSuppressed of the WebBrowser control to true to suppress the JavaScript error message.


In order to allow the code on hulu.com to execute, you must run the Webbrowser control in a mode such that it runs with newer version features. This can only be done by setting registry entries.

See this question and the answers for details.


To specify: I have a demo application to open the hulu website with the embedded WebBrowser control named WindowsFormsApplication5.exe.

Without registry changes, I see a note by Hulu that JavaScript support is not enabled. When sniffing the network transfer with Fiddler, I see that the following request is sent to the Hulu server:

GET http://www.hulu.com/ HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
Accept-Language: de-DE,de;q=0.5
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; Creative AutoUpdate v1.41.09)
Host: www.hulu.com
Connection: Keep-Alive
Pragma: no-cache

Note the version number "7.0" in the User-Agent string.

I now add a registry key of type REG_DWORD with name "WindowsFormsApplication5.exe" and value 0x00002af9 (11001) in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION.

As a result, the Hulu Website is successfully displayed in my demo application and I see the following request being sent via Fiddler:

GET http://www.hulu.com/ HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
Referer: http://www.hulu.com/
Accept-Language: de-DE,de;q=0.5
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: www.hulu.com
Connection: Keep-Alive

Notice the different User-Agent string after the registry changes.


Registry setting to use IE 11 in WebBrowser Control in Demo Application

Demo Application showing Hulu Website after registry changes