Reputation: 18802
I'm building a Windows Forms application which makes use of the WebBrowser control. Can anyone tell me what rendering engine the control uses?
Is it fixed based on the version of the .NET framework I'm developing against or is it based on the version of IE installed on the client's machine? Does the client even need IE?
In other words, if a website looks right in my application on my machine, is it reasonably safe to assume it'll render right on everyone else's machine?
Thanks!
Upvotes: 9
Views: 6271
Reputation: 379
You should set the registry key, otherwise the webBrowser will render as IE4
See here: http://www.west-wind.com/weblog/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
Registry Key Location for FEATURE_BROWSER EMULATION You can specify these keys in the registry at:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION The HKCU key is the best place to set these values because there's a single key and it can be set without admin rights, but you can also set these keys at the machine level at HKLM:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION or for a 32 bit application on a 64 bit machine:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
Key Name The keyname is the EXE name of your application like:
outlook.exe MarkdownMonster.exe
Values
The value specifies the IE version as follows:
The value to set this key to is (taken from MSDN here) as decimal values:
11001 (0x2AF9) Internet Explorer 11. Webpages are displayed in IE11 Standards mode, regardless of the !DOCTYPE directive.
11000 (0x2AF8) Internet Explorer 11. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode.
10001 (0x2AF7) Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive.
10000 (0x2710) Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode.
9999 (0x270F) 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.
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.
7000 (0x1B58) Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode. This mode is kind of pointless since it's the default.
Setting these keys enables your applications to use the latest Internet Explorer versions on your machine easily. Unfortunately there doesn't seem to be a key that says use the latest version that's installed - you have to be specific regarding the version unfortunately. Given that Windows 7 and later can run IE 11, I'm requiring users to have IE 11 if I want to use HTML5 and more advanced CSS features like Flexbox, but if your content is simpler you can probably get away with using IE 10 or even IE 9.
Upvotes: 0
Reputation: 941545
It will be the version of IE installed on the target machine. There can only be one, IE doesn't support side-by-side installation of versions. You don't know for a fact your app will work without issue unless you test it on different machines that have versions 6, 7 and 8 installed. This is normally the burden of the web site author.
Upvotes: 5