问题描述
我正在使用IE8浏览器在Win7机器上进行开发(同样的事情也发生在IE9上)。
I'm developing on a Win7 machine with IE8 browser (same thing occurs also on IE9).
我创建了一个嵌入在本机窗口中的 IWebBrowser2 对象的应用程序。
在该浏览器对象中我执行javascipt代码:
I've create an application with an IWebBrowser2 object embedded within a native window.
Within that browser object i execute a javascipt code:
var txt = "Browser Name: " + navigator.appName + "\n";
txt += "Browser Version: " + navigator.appVersion + "\n";
alert(txt);
我收到以下警告:
这证实了我之前的担忧 - 即使在我的机器上安装了IE8 \ IE9时 - IWebBrowser2 对象的行为就像是 IE7 (包括所有烦人的HTML \ CSS行为)。
That confirmed my earlier worries - even when having IE8\IE9 installed on my machine - the IWebBrowser2 object behaves as if it was IE7 (including all of the annoying HTML\CSS behaviors).
有谁知道这是为什么?或更好 - 如果有可能将浏览器对象嵌入IE8\IE9(用于分发 - 所以它应该是合法的)
Does anyone know why this is? or better - if there is any possibility to embed a browser object as IE8\IE9 (for distribution - so it should be legal)
谢谢,
推荐答案
IE7是嵌入式IE控件的默认渲染模式(出于兼容性原因)。使用注册表项改变这一点。
IE7 is the default rendering mode for embedded IE controls (for compatibility reasons). Use the FEATURE_BROWSER_EMULATION registry key to change that.
阅读或,以了解如何执行此操作。
Read Plip's answer over here or IEBlog to get an idea how to do this.
这篇关于IWebBrowser2对象使用IE7版本,而不是机器上安装的IE版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!