问题描述
我想知道如何阻止使用IE 8的用户进入兼容模式?
I am wondering how do you stop people who are using IE 8 from going to Compatibility mode?
<meta http-equiv="X-UA-Compatible" content="IE=8" />
我发现这个标签,我认为这会迫使人们保持IE-8模式,但我不是太确定了,不能检查,因为我有IE 9。
I found this tag and I think this forces people to stay in IE-8 mode but I am not too sure and can't check as I have IE 9.
如果人们处于IE 9模式,我强迫他们不进入IE 8或IE 7兼容模式?
If people are in IE 9 mode I force them to not go into IE 8 or IE 7 Compatibility mode?
我试图将上面一行放在我的代码中并转到IE 9 - >工具 - >兼容性视图(灰显)
I tried to put the above line in my code and went to IE 9 -> Tools -> Compatibility View(Grayed Out)
但兼容性视图设置并未显示为灰色,似乎您可以通过那里添加网站。
but "Compatibility View Settings" was not grayed out and it seems you could add the site through there.
那么这应该禁用吗?
推荐答案
<meta http-equiv="X-UA-Compatible" content="IE=8" />
应强制您的页面以IE8标准呈现。用户可以将站点添加到兼容性列表中,但此标记优先。
should force your page to render in IE8 standards. The user may add the site to compatibility list but this tag will take precedence.
检查的一种快速方法是加载页面并在地址栏中键入以下内容:
A quick way to check would be to load the page and type the following the address bar :
javascript:alert(navigator.userAgent)
如果你在字符串中看到IE7,它将以兼容模式加载,否则不加载。
If you see IE7 in the string, it is loading in compatibility mode, otherwise not.
这篇关于如何在IE中禁用兼容性视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!