Browers Meta Tag X-UA-Compatible
Posted by Kevin | Filed under HTML/CSS/JS | 2009-01-29
打开浏览器查看liupeng.us的页面源代码,细心的朋友会发现meta信息里面多了个tag标签
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="utf-8" />
- <meta http-equiv="x-ua-compatible" content="IE=7" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta content="关注WEB标准,用户体验,关注前端技术,网页设计师,前端开发工程师,liupeng,Beijing China" name="keywords" />
- <meta content="关注WEB标准,用户体验,关注前端技术,网页设计师,前端开发工程师,liupeng,Beijing China" name="description" />
- <meta content="SaBlog" name="copyright" />
里面多了一句
- <meta http-equiv="X-UA-Compatible" content="IE=7" />
X-UA-Compatible 是什么?
看看MSDN上的资料说明:
In IE8 Beta 1, that option is the “IE=7” X-UA-Compatible tag, which instructs IE8 to display content in IE7 Standards mode. However, the scenario this doesn’t address is when IE=7 is applied as an HTTP header to a site that contains Quirks mode pages. The IE=7 HTTP header will force all pages – both Quirks and Standards – to display in IE7 Standards mode. Developers using this header while updating their sites would then have to add the “IE=5” <META> tag to each page they want to keep in Quirks mode. This logic is fine for many websites. However, if a site has lots of Quirks mode pages, or for the case where pages with frames host a mix of Strict and Quirks mode content – as brought to light by IE8 Beta 1 user feedback – the compatibility opt-out adds a bit more work than we intended.
主要意思我总结一下:
X-UA-Compatible是针对ie8新加的一个设置,对于ie8之外的浏览器是不识别的,这个区别与content="IE=7"在无论页面是否包含<!DOCTYPE>指令,都像是使用了 Windows Internet Explorer 7的标准模式。而content="IE=EmulateIE7"模式遵循<!DOCTYPE>指令。对于多数网站来说,它是首选的兼容性模式。
目前IE8尚在测试版中,所以为了避免制作出的页面在IE8下面出现错误,建议直接将IE8使用IE7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:
- <meta http-equiv="X-UA-Compatible" content="IE=7" />
这样我们才能使得页面在IE8里面表现正常!


2009-01-30, 12:00 AM
我的在IE8下面,好像显示是正常的!
2009-01-30, 10:25 AM
IE8到现在应该全部通过了CSS2.1的检测了。应该不会出现特别的BUG。
2009-01-30, 9:22 PM
哎,ie真麻烦...,要是能像FF一样自动升级就好了...
我之前留的FF2已强行变成了FF3
2009-01-30, 9:46 PM
是的IE烦,做前端必须考虑到浏览器的分布,毕竟现在MSIE占领的市场还是不容忽视的...- -!