How can I set the WPF webbrowser controls to render pages in iE10 mode or the higher version installed on a machine? By default, if I create a .net 4 or .net 4.5 application on any machine of OS > Windows 7, it renders the html pages in IE7 mode only. (Please correct me if I am wrong). How to enable the application to render the html pages in IE10 mode if IE10 is installed on the target machine?
3 Answers
If you don't want to modify the registry and you control the webpage, you can use the
<meta http-equiv="X-UA-Compatible" content="IE=10">
tag in the document's head. I believe it has to be first or immediately following <title>
in order to work.

- 12,621
- 7
- 81
- 125
-
1This is the true correct answer. There is no need to edit a registry and it worked perfectly for me. – scottheckel Feb 03 '18 at 15:09
-
Can I have multiple of it? Assume user runs on Windows 7 and I set `IE=11`, does Windows 7 renders it in IE10 mode? – Luke Vo Apr 11 '18 at 17:23
-
2@Luke Set content="IE=edge". – Der_Meister May 04 '18 at 05:59
-
Confirmed. If you control what is loaded in the HTML control this is the best way to go. No registry changes that may affect other apps. Thanks – carlos357 Oct 01 '18 at 14:28
You can use the registry as described here:
http://msdn.microsoft.com/en-us/library/ie/ee330730%28v=vs.85%29.aspx
EDIT: for a better explanation you can read this answer too Will the IE9 WebBrowser Control Support all of IE9's features, including SVG?

- 1
- 1
-
If we do the registry edit , then i have to do the same in target machine as well , right?Also if the browser mode is changed to IE9 /10 by changing registry does this affect the browser control inside the application only or the entire IE application> – Sebastian May 21 '14 at 07:48
-
You have to do the same on target machine. It affects only the browser in the application because you have to set in the registry the name of the app. – May 21 '14 at 08:57
-
1I followed instructions in http://kirubhananth.blogspot.in/2013/04/how-to-load-html-5-content-in-wpf.html and i ma getting document mode as 5 . Any idea why. But my Registry says IETest.exe value as 270f (Of IE 9) . Is there any impact of location of IETest.exe – Sebastian May 21 '14 at 09:48
-
If your wpf app is in 32 bit you have to use Wow6432Node , instead if is 64 bit no. – May 21 '14 at 10:03
-
My app targets any platform mode and i tried by adding both 32 bit and 64 bit , but all cases it returns 5 – Sebastian May 21 '14 at 10:08
-
Its working now. I crosscheck the path of registry and its now rendering in IE9 mode – Sebastian May 21 '14 at 10:39
-
-
For WPF webbrowser control use IE11 mode need , for example, in the constructor of the main window, add the following code:
var pricipal = new System.Security.Principal.WindowsPrincipal(
System.Security.Principal.WindowsIdentity.GetCurrent());
if(pricipal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)) {
RegistryKey registrybrowser = Registry.LocalMachine.OpenSubKey
(@"Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
string myProgramName = Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location);
var currentValue = registrybrowser.GetValue(myProgramName);
if (currentValue == null || (int)currentValue != 0x00002af9)
registrybrowser.SetValue(myProgramName, 0x00002af9, RegistryValueKind.DWord);
}
else
this.Title += " ( Первый раз запускать с правами админа )";
If you want to see WPF webbrowser control use IE11 mode in DEBUG mode when run from visual studio, you need to add in the registry all progmam "*". This can be done with the following code:
var pricipal = new System.Security.Principal.WindowsPrincipal(
System.Security.Principal.WindowsIdentity.GetCurrent());
if (pricipal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)) {
RegistryKey registrybrowser = Registry.LocalMachine.OpenSubKey
(@"Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
var currentValue = registrybrowser.GetValue("*");
if (currentValue == null || (int)currentValue != 0x00002af9)
registrybrowser.SetValue("*", 0x00002af9, RegistryValueKind.DWord);
}
else
this.Title += " ( Первый раз запускать с правами админа )";
Checked for windows 10 and visual studio 2015.
Remark: codes other versions of internet explorer, see here https://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx#browser_emulation

- 3,058
- 1
- 22
- 27
-
1Thank you for the code, the only one that worked in W10. However, you don't need to add registry all program to work in your debug mode. You can simply register as the vshost name the same way you register the program name. string appName = System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().Location); string appNameExe = appName + ".exe"; string appVSNameExe = appName + ".vshost..exe"; then apply your currentvalue for appNameExe and for appVSNameExe and it will work for both without forcing * all – Luishg Sep 24 '17 at 20:13