Articles in categories

Articles

Change IE version for the WPF WebBrowserControl

When you use the WPF WebBrowserControl you'll notice that it uses the IE7 renderer out of the box. Now IE7 is a bit out dated so I wanted to make the WebBrowserControl to use the latest IE version on my system. In my case that will be IE9.
After some searching with the help of my 'best' friend Google I found that you can fix this with an registery key.

There are 2 keys available to make this work. Depending on your application and Windows version you'll need to create the correct one.

For the 32bit Windows version:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

For the 64bit Windows version:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

The key value to create is this:
"MyTestApplication.exe"=dword:0x270f

You can use other key values, depending on what IE version you want to use. See table below.

Value Description
10001 (0x2711) Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive.
10000 (0x02710) Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. Default value for Internet Explorer 10.
9999 (0x270F) Windows Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive.
9000 (0x2328) Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode. Default value for Internet Explorer 9.
8888 (0x22B8) Webpages are displayed in IE8 Standards mode, regardless of the !DOCTYPE directive.
8000 (0x1F40) Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode. Default value for Internet Explorer 8
7000 (0x1B58) Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode. Default value for applications hosting the WebBrowser Control.

After adding this key you'll see that the WebBrowserControl uses your specified IE version. 

These two sites helped me figuring this out:


I've added my version of the script as a download. You only need to replace the YourAppName with the name of your application and if needed change the dword value for targeting another version of IE.
In the script you'll find also a key for the vshost versions.

It looks like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"YourAppName.exe"=dword:270f

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"YourAppName.exe"=dword:270f

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"YourAppName.vshost.exe"=dword:270f

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"YourAppName.vshost.exe"=dword:270f

Note: It's possible that your browser will give a warning when downloading this zip file, but that is just because of the .reg file inside it. You can ignore that warning or if you don't trust it copy the script from the above code block. it's up to you.