强制 IE8 *不* 使用兼容性视图 [英] Force IE8 *not* to use Compatibility View
问题描述
刚刚将我的网站更新为更新、更符合标准的设计.我之前的设计太垃圾了,我不得不使用 IE=EmulateIE 标签来强制 IE7 仿真.
Just updated my site to newer, much more standards compliant design. My previous design was so rubbish that I had to use the IE=EmulateIE tag to force IE7 emulation.
不幸的是,我相信浏览器可能会缓存以前访问的这个设置,导致我的新网站(没有按下按钮看起来很棒)再次看起来很垃圾......
Unfortunately, I believe that browsers may be caching this setting from previous visits, causing my new site (which looks great without the button pressed) to look rubbish again...
是否有任何我可以使用的相反标记,或者我可以让 PHP 对 HTTP 标头执行一些魔术以禁用此设置的缓存?
Is there any opposite tag that I could use, or some magic I can make PHP do to the HTTP headers disable caching of this setting?
推荐答案
在没有 X-UA-Compatible http-equiv 标头的情况下,兼容模式由 !DOCTYPE
(或没有 !DOCTYPE
,视情况而定).对于 !DOCTYPE
为您提供哪种模式(在各种浏览器中)的图表,请参见此处:
In the absence of an X-UA-Compatible http-equiv header, the compatibility mode is determined by the !DOCTYPE
(or the absence of a !DOCTYPE
, as the case may be). For a chart of which !DOCTYPE
gives you which mode (in various browsers) see here:
http://hsivonen.iki.fi/doctype/(您需要向下滚动到页面底部.)
http://hsivonen.iki.fi/doctype/ (You'll need to scroll down toward the bottom of the page.)
您可以通过使用 meta
元素来指定 X-UA-Compatible http-equiv 标头来覆盖此行为,如下所示:<meta http-equiv="X-UA-Compatible" content="IE=edge" >
You can override this behavior by using a meta
element to specify an X-UA-Compatible http-equiv header, like so:
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
(注意:IE=edge 使用最高可用版本——截至本文发布时当前为 IE8——或者可以明确指定 IE8.)
(Note: IE=edge goes with the highest available version -- currently IE8 as of this posting -- or one can explicitly specify IE8.)
有关更多信息,请参见此处:http://msdn.microsoft.com/en-us/图书馆/cc288325(VS.85).aspx
For more information, see here: http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx
这篇关于强制 IE8 *不* 使用兼容性视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!