9

We are using an embedded SWT Browser in a Java application. The SWT Browser wraps an IE8 WebBrowser Control object. I am running into the well-known issue that by default, the WebBrowser Control uses IE7 mode instead of IE8 mode. (See http://blogs.msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx)

Per this and other articles, I am trying to set the FEATURE_BROWSER_EMULATION registry value for my application so that the Browser defaults to IE8 mode, but I am having mixed success. Setting it to IE8 Standards Mode using the value 8000 does not work, butsetting it to "Forced" IE8 Standards Mode using value 8888 does.

I am testing this by loading the page in the SWT Browser and then executing the javascript

browser.execute("alert(document.documentMode);");

The result is 7 if the key value does not exist or is 8000. The result is 8 if the key value is 8888. The URL I am testing against is http://stackoverflow.com, which includes the following

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Does anyone know what I am doing wrong?

ghirschhorn
  • 311
  • 1
  • 4
  • 7

3 Answers3

6

Check this Solution First :

Regarding IE9 WebBrowser control

if it does not meet your need, here is the registry solution


To run a WebBrowser control in IE11 Standards Mode, use the following new value into the registry:

32 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]

64 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\wow6432node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
 "DesignU.exe" = dword 11000 (Hex: 0x2af8)

To run a WebBrowser control in IE10 Standards Mode, use the following new value into the registry:

32 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]

64 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\wow6432node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
 "DesignU.exe" = dword 10000 (Hex: 0x2710)

To run a WebBrowser control in IE9 Standards Mode, use the following new value into the registry:

32 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]

64 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\wow6432node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
 "DesignU.exe" = dword 9000 (Hex: 0x2328)

To run a WebBrowser control in IE8 Standards Mode, use the following new value into the registry:

32 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]

64 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\wow6432node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
 "DesignU.exe" = dword 8000 (Hex: 0x1F40)

To run in IE7 Standards Mode, use the following registry value:

32 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]

64 bits: [(HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE)\Software\wow6432node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
 "DesignU.exe" = dword 7000 (Hex: 0x1B58)
Community
  • 1
  • 1
Kamyar Gilak
  • 1,044
  • 2
  • 17
  • 23
  • 1
    This is exactly what I needed! It should also be noted that to use `HKEY_LOCAL_MACHINE` you need permissions, so it's best to do that at the installer step or use `HKEY_CURRENT_USER` if you need to change it at runtime. You can also get the highest system browser version from `\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\svcVersion` (or `Version`) if you want to set your emulation mode to use the highest available (not sure if something like `99999` would do that). – Beejor Feb 18 '16 at 02:13
  • To set FEATURE_BROWSER_EMULATION in HKCU the same key is used on 32 bit and 64 bit (i.e. No wow6432node): HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION – LesFerch Aug 13 '21 at 02:37
  • It's clearly shown here: https://blog.malwarebytes.com/101/2016/01/a-brief-guide-to-feature_browser_emulation/ – LesFerch Aug 13 '21 at 02:37
5
  1. HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
  2. Added your process name then set the DWORD value is 9999
bensiu
  • 24,660
  • 56
  • 77
  • 117
tough_lion
  • 51
  • 1
  • 2
1

Check the compatibility view settings in standalone IE (Tools > compatibility view settings). Is your page listed in the 'sites to display in compability view list' or is the 'show all sites in compatiblity view' box checked? With that reg value set to 8000, webbrowser control still honors compatibility view settings.

jakeC
  • 11
  • 1