gpt4 book ai didi

winforms - 如何关闭 WinForms 应用程序中 IE WebBrowserControl 的兼容性 View ?

转载 作者:行者123 更新时间:2023-11-28 11:33:40 25 4
gpt4 key购买 nike

在我的 WinForms 应用程序中,如果我使用 WebBrowser 控件,它似乎被强制进入兼容模式。我怎样才能禁用它,并使其在浏览同一站点时与独立 IE 在我的计算机上的行为相同?

  • 我不想更改注册表。我希望所有内容都包含在我的应用程序中。
  • 我正在加载的网站不是我的,所以我无法对其进行更改(除非它们可以在我的应用程序中以编程方式完成)。

最佳答案

除了配置以下注册表设置外,别无他法:

HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

或者如果它是 64 位 Windows 上的 32 位应用程序:

HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION`

这些设置没有出现在 WebBrowser 中控制。

更多信息请看:

What IE compatibility mode does the webbrowser control use?

如果链接失效:

您创建一个 DWORD与您的可执行文件名称匹配的值,并将此值设置为以下之一:

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

例如:

enter image description here

来 self 自己对 IE9 的实验:

  • 9000 - 继承 IE9 全局兼容模式设置中设置的兼容模式。 IE。: enter image description here

  • 9999 - 强制 IE9 在主机应用程序中退出兼容模式,无论全局配置的兼容模式设置如何

您的应用程序可能需要检测可用的基础 IE 版本以确定要使用的值:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version

或者如果它是 64 位 Windows 上的 32 位应用程序:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Version

还有这篇 IE8 发布时的旧文章值得一看:

More IE8 Extensibility Improvements

您还可以在每个用户的基础上配置这些设置:

HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

关于winforms - 如何关闭 WinForms 应用程序中 IE WebBrowserControl 的兼容性 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21020188/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com