利用Meta标签的X-UA-Compatible来兼容IE8

  前不久,我在一网页源代码中发现一以前未见过的标签:
[code][/code]
  那么这个标签是什么意思呢?我们先来看下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” 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″在无论页面是否包含指令,都像是使用了 Windows Internet Explorer 7的标准模式。而content=”IE=EmulateIE7″模式遵循指令。对于多数网站来说,它是首选的兼容性模式。

  对于多数网站来说,它是首选的兼容性模式。

  大多数站点是在IE8正式版发布之前建立的,之前我们没有把办法考虑到IE8的兼容性,所以为了避免制作出的页面在IE8下面出现错误,建议直接将IE8使用IE7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:

[code][/code]

  这样我们才能使得页面在IE8里面表现正常!

发表评论

电子邮件地址不会被公开。 必填项已用*标注