In my WinForms app, if I use a WebBrowser control, it seems to be forced into compatibility mode. How can I disable this, and make it behave the same as standalone IE does on my machine when browsing the same site?
There is no way to do this other than configuring the following registry settings:
HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
or if it's a 32 bit app on 64 bit Windows:
HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION`
These settings aren't surfaced in the WebBrowser
control.
For more information please see:
In case the link dies:
You create a DWORD
value matching the name of your executable and set this value to one of:
7000: Pages containing standards-based
<!DOCTYPE>
directives are displayed in IE7 mode.
8000: Pages containing standards-based<!DOCTYPE>
directives are displayed in IE8 mode
8888: Pages are always displayed in IE8 mode, regardless of the<!DOCTYPE>
directive. (This bypasses the exceptions listed earlier.)
9000: Use IE9 settings!
9999: Force IE9
For example:
From my own experiments with IE9:
9000 - inherits the compatibility mode set in IE9's global compatibility mode setting. i.e.:
9999 - forces IE9 out of compatibility mode in the host application regardless of the globally configured compatibility mode setting
Your application would probably need to detect which underlying IE version is available to determine which value to use:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version
or if it's a 32 bit app on 64 bit Windows:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Version
There's also this older article from when IE8 came out which is worth a look:
You can also configure these settings on a per user basis under:
HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION