IE8 模拟IE7 行为设置(转贴)

工作原因,接触了下IE8,主要是研究IE8在模拟IE7行为上的差别, 在这推荐下面的blog还有msdn的相关信息

http://blogs.msdn.com/ie/archive/2008/06/10/introducing-ie-emulateie7.aspx

http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx


总结来说,可以有3种方式,让IE8来模拟IE7的行为:

1) IE8 Compatibility View Setting 模式:勾选 “Display all website in Compatibility View” (IE8提供了3种方式,可以根据需要选择适合的)

我在这选择的是所有访问的site都将模拟IE7的模式 

2) 在server端的web.config种, 添加一个 custom HTTP header:<add name="X-UA-Compatible" value="IE=EmulateIE7" />               

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.

当server上大多数site需要此操作时,可以使用这个设置。

3) 在client端添加一个特殊的 HTML tag ,在需要的page上: 添加<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 在 <head> 标签里面

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

此设置是相对特别页面有效的。

原帖地址:http://joeytravel.blog.sohu.com/116239542.html

原文地址:https://www.cnblogs.com/heimark/p/1700345.html