添加http头以强制IE8在IE7模式下呈现

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了添加http头以强制IE8在IE7模式下呈现相关的知识,希望对你有一定的参考价值。

In summary, IE7 compatibility support looks as follows:

IE=7

Display in IE7 Standards mode; Already supported in the IE8 Beta 1 release

IE=EmulateIE7

Display standards DOCTYPEs in IE7 Standards mode; Display quirks DOCTYPEs in Quirks mode; Available through the IE June Security Update for IE8 Beta 1

There are two ways to implement this tag:

* On a per-site basis, add a custom HTTP header

X-UA-Compatible: IE=EmulateIE7

* On a per-page basis, add a special html tag to each document, right after the tag



Implementing the HTTP header is beneficial if a site owner wants most of their site to render as it did in IE7 or if there are no plans to update site content. Inclusion of this header honors any Quirks mode pages that belong to the site.

Using the meta-tag on a per-page basis is beneficial when the publisher wants to opt-in specific pages to render as they did in IE7.

NOTE: The X-UA-Compatible tag and header override any existing DOCTYPE. Also, the mode specified by the page takes precedent over the HTTP header. For example, you could add the EmulateIE7 HTTP header to a site, and set specific pages to display in IE8 mode (by using the meta-tag with content=”IE8”).
  1. <FilesMatch ".(html|htm|php)$">
  2. Header set X-UA-Compatible "IE=7"
  3. </FilesMatch>
  4.  
  5.  
  6. <FilesMatch ".(html|htm|php)$">
  7. Header set X-UA-Compatible "IE=EmulateIE7"
  8. </FilesMatch>

以上是关于添加http头以强制IE8在IE7模式下呈现的主要内容,如果未能解决你的问题,请参考以下文章

PHP 添加http标头以强制IE8在IE7模式下呈现(PHP-Version)

如何强制 Internet Explorer 以标准模式而不是 Quirks 模式呈现?

与在 IE8 浏览器中以 IE7 标准模式呈现的相同页面相比,在 IE7 中呈现的页面是不是会有任何差异?

强制 IE8 进入 IE7 兼容模式

IE10 以 IE7 模式呈现。如何强制标准模式?

ie6 ie7 ie8 ie9兼容问题终极解决方案