几个你可能没用过的标签(Meta)

Posted on 2010-03-18 09:23  萧木柯  阅读(356)  评论(0)    收藏  举报
X-UA-Compatible
msdn上关于X-UA-Compatible的说明:

  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使用IE7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:
<meta http-equiv="X-UA-Compatible" content="IE=7" />
  这样我们才能使得页面在IE8里面表现正常!

关于X-UA-Compatible的其它几个用法:

<meta http-equiv="X-UA-Compatible" content="IE=5" />
像是使用了 Windows Internet Explorer 7 的 Quirks 模式,这与 Windows Internet Explorer 5 显示内容的方式很相似。

<meta http-equiv="X-UA-Compatible" content="IE=7" />
无论页面是否包含 <!DOCTYPE> 指令,都像是使用了 Windows Internet Explorer 7 的标准模式。

<meta http-equiv="X-UA-Compatible" content="IE=8" />

<meta http-equiv="X-UA-Compatible" content="edge" />
Edge 模式通知 Windows Internet Explorer 以最高级别的可用模式显示内容,这实际上破坏了“锁定”模式。

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
EmulateIE7 模式通知 Windows Internet Explorer 使用 <!DOCTYPE> 指令确定如何呈现内容。标准模式指令以Windows Internet Explorer 7 标准模式显示,而 Quirks 模式指令以 IE5 模式显示。与 IE7 模式不同,EmulateIE7 模式遵循 <!DOCTYPE> 指令。对于多数网站来说,它是首选的兼容性模式。

MSSmartTagsPreventParsing和MSThemeCompatible
在microsoft网站源码顶部有以下两行代码:
<meta http-equiv='MSThemeCompatible' content='yes' />
<meta name='MSSmartTagsPreventParsing' content='yes' />

代码解释如下:
MSSmartTagsPreventParsing的解释是:
在Microsoft IE 6 中有一个 Smart tag 开关,如果您包含下面标记,访问这将看不到某些相关连接,这样可以避免访问者流失到竞争对手的网站上去。

MSThemeCompatible的解释是:
是否在IE中关闭xp 的主题用法:<Meta http-equiv=”MSThemeCompatible” Content=”No”> 关闭xp 的蓝色立体按钮系统显示样式。