IE 8的开发者工具:浏览器模式:IE 7,IE 8,但什么是IE 8“兼容性视图”?

时间:2010-06-23 22:47:40

标签: internet-explorer internet-explorer-8 internet-explorer-7 ie8-compatibility-mode

在IE 8中,我们可以展示开发者工具。然后在顶部,有一个浏览器模式:

IE 7
IE 8
IE 8 Compatibility View

因此,如果IE 7强制页面显示为浏览器是IE 7,那么 IE 8是强制使用标准IE 8来显示页面,
那么额外的IE 8 "Compatibility View"是多少?有什么用?如果我们已经拥有IE 7,为什么需要这种额外模式?这种模式对IE 7模式不能做什么?

1 个答案:

答案 0 :(得分:6)

区别在于用户代理字符串。

“IE7”完全模拟IE7的用户代理字符串,显示MSIE 7.0。 “IE8”完全使用IE8的本机用户代理字符串,显示MSIE 8.0以及Trident / 4.0,这是IE8中使用的Trident布局引擎的版本。

IE8-Compatibility使用浏览器的本机用户代理字符串,但将“8.0”更改为“7.0”。

由于Trident在IE7之前没有版本号,因此IE7字符串不显示“Trident / x.x”。因此,对于MSIE 7.0用户代理字符串,如果还存在“Trident / 4.0”,则您知道IE8在兼容性视图中运行;如果“Trident / x.x”不在那里,你知道它是IE7模式下的真正的IE7或IE8(不是兼容模式)。

我希望我的解释足够清楚,下面是一些用户代理字符串的示例。

IE7:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; FDM; MS-RTC EA 2; Tablet PC 2.0; .NET4.0C; .NET4.0E)

IE8:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; FDM; MS-RTC EA 2; Tablet PC 2.0; .NET4.0C; .NET4.0E)

IE8-兼容性:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; FDM; MS-RTC EA 2; Tablet PC 2.0; .NET4.0C; .NET4.0E)