如何让Delphi TWebbrowser组件运行在IE9模式? [英] How to have Delphi TWebbrowser component running in IE9 mode?

查看:203
本文介绍了如何让Delphi TWebbrowser组件运行在IE9模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于TWebbrowser以IE7兼容模式运行,因此TWebbrowser遇到Javascript错误。



有没有办法防止这种情况,只是让它运行在IE9模式下?

解决方案


  1. 选择加入浏览器仿真功能使用记录的注册表项

  2. 根据您选择的浏览器仿真设置,您可能需要确保您的文档包含合适的DOCTYPE。再次,这在文档中有所描述。

所以,例如,如果你想做出最简单的改变,你将添加以下注册表设置:

 
HKEY_LOCAL_MACHINE(或HKEY_CURRENT_USER)
软件
Microsoft
Internet Explorer

FeatureControl
FEATURE_BROWSER_EMULATION
YourExeNameGoesHere.exe =(DWORD)00009999

价值 9999的文档说:


9999 Windows Internet Explorer 9.网页以IE9标准模式显示,不管如果您使用 9000 ,那么您可以使用!DOCTYPE指令。


还需要修改文档的DOCTYPE:


9000 Internet Explorer 9.包含基于标准的DOCTYPE指令的网页以IE9模式显示。 Internet Explorer 9的默认值。


链接的文档还包括指定其他IE版本所需的信息。


I am experiencing Javascript errors with TWebbrowser due to the fact that TWebbrowser is running in IE7 compatibility mode.

Is there a way to prevent this and just have it run in IE9 mode?

解决方案

  1. Opt in to the browser emulation feature using the documented registry key.
  2. Depending on the browser emulation setting that you selected, you may need to ensure that your document contains a suitable DOCTYPE. Again, this is described in the documentation.

So, for example, if you wish to make the simplest possible change you would add the following registry setting:

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
   SOFTWARE
      Microsoft
         Internet Explorer
            Main
               FeatureControl
                  FEATURE_BROWSER_EMULATION
                     YourExeNameGoesHere.exe = (DWORD) 00009999

The documentation for the value 9999 says:

9999 Windows Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive.

Were you to use 9000 then you'd need also to modify the DOCTYPE of your document:

9000 Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode. Default value for Internet Explorer 9.

The linked documentation also includes the information required to specify other IE versions.

这篇关于如何让Delphi TWebbrowser组件运行在IE9模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆