运行时的 TWebBrowser 和 FEATURE_BROWSER_EMULATION
有没有人尝试在运行时创建和销毁 TWebBrowser 并使用 FEATURE_BROWSER_EMULATION 来切换浏览器模式,然后重新创建 TWebBrowser 以启用切换模式而无需重新启动应用程序?
我想知道是否仅在启动应用程序时或创建 Web 浏览器控件时读取该设置。
Has anyone tried creating and destroying a TWebBrowser at runtime and using FEATURE_BROWSER_EMULATION to switch the browser mode before re-creating the TWebBrowser to enable switching the mode without restarting the application?
I'm wondering if the setting is only read when starting the app, or when the web browser control is created.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不需要自己创建或销毁 TEmbeddedWB。我这样做(见下文)是为了为应用程序设置正确的 IE 版本。工作完美。您必须在创建表单之前执行此操作。您可以在初始化语句中执行此操作,例如:
如何使用它的示例:
You don't need to create or destroy a TEmbeddedWB yourself. I made this (see below) to set the correct IE version for an app. Works perfecctly. You must do this before the form is created. You can do this in a initialization statement, for example:
Example how to use it:
我尝试了一下,但没有成功。
这就是我所做的:
显示当前用户代理 - 它显示 MSIE 7.0(安装的是 9.0,所以
嵌入式控件的兼容模式启动)
运行我将应用程序添加到
HKCU\Software\Microsoft\Internet
强制执行Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
使用版本 9(为我的 exe 名称添加了 9999)
TWebBrowser 并加载与步骤 1 相同的网页 - 但用户代理
仍然显示 MSIE 7.0
代理从一开始就是 9.0
所以看来你必须重新启动应用程序。
I tried it and it didn't work.
This is what I did:
that displays the current user agent - it displayed MSIE 7.0 (installed is 9.0, so
compatibility mode for embedded controls kicked in)
running I added the application to
HKCU\Software\Microsoft\Internet
to enforceExplorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
use of version 9 (added 9999 for my exe name)
a TWebBrowser and loaded same web page as in step 1 - but user agent
still showed MSIE 7.0
agent was 9.0 from the beginning
So it seems like you would have to restart the application.