如何将 FEATURE_BROWSER_EMULATION 设置为 IE8 模式?

发布于 2024-10-08 00:42:24 字数 888 浏览 0 评论 0原文

我们在 Java 应用程序中使用嵌入式 SWT 浏览器。 SWT 浏览器包装了 IE8 WebBrowser Control 对象。我遇到了一个众所周知的问题,默认情况下,WebBrowser 控件使用 IE7 模式而不是 IE8 模式。 (请参阅 http://blogs .msdn.com/b/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx

根据这篇文章和其他文章,我尝试为我的应用程序设置 FEATURE_BROWSER_EMULATION 注册表值,以便浏览器默认为 IE8 模式,但我的成功程度参差不齐。使用值 8000 将其设置为 IE8 标准模式不起作用,但使用值 8888 将其设置为“强制”IE8 标准模式则有效。

我通过在 SWT 浏览器中加载页面然后执行 javascript 来测试这一点。

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

如果键值不存在或为 8000,结果为 7。如果键值为 8888,结果为 8。我测试的 URL 是http://stackoverflow.com,其中包括以下内容

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

有人知道我做错了什么吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

窝囊感情。 2024-10-15 00:42:24

首先检查此解决方案:

关于 IE9 WebBrowser 控件

如果它不能满足您的需求,这里是注册表解决方案


要在 IE11 标准模式下运行 WebBrowser 控件,请在注册表中使用以下新值:

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)

要在 IE10 标准模式下运行 WebBrowser 控件,请使用以下新值进入注册表:

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)

要在 IE9 标准模式下运行 WebBrowser 控件,请在注册表中使用以下新值:

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)

要在 IE8 标准模式下运行 WebBrowser 控件,请使用以下命令将新值添加到注册表中:

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)

要在 IE7 标准模式下运行,请使用以下注册表值:

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)

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)
空城旧梦 2024-10-15 00:42:24
  1. HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
  2. 添加您的进程名称,然后将 DWORD 值设置为 9999
  1. HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
  2. Added your process name then set the DWORD value is 9999
来日方长 2024-10-15 00:42:24

检查独立 IE 中的兼容性视图设置(工具 > 兼容性视图设置)。您的页面是否列在“要在兼容性视图列表中显示的网站”中,或者是否选中了“在兼容性视图中显示所有网站”框?将 reg 值设置为 8000 后,Web 浏览器控件仍遵循兼容性视图设置。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文