TWebbrowser控件使用IE版本默认是7, 即使你的电脑安装了IE11。如何更改为其他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?
Answer:
- Opt in to the browser emulation feature using the documented registry key.
- 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 thedocumentation.
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.

本文介绍如何通过修改注册表键值使Delphi中的TWebbrowser组件运行在不同的IE模式下,例如IE9模式,以解决JavaScript错误问题。

被折叠的 条评论
为什么被折叠?



