当前位置: 移动技术网 > IT编程>网页制作>CSS > <meta http-equiv="X-UA-Compatible" content="ie=edge">的作用

<meta http-equiv="X-UA-Compatible" content="ie=edge">的作用

2018年11月07日  | 移动技术网IT编程  | 我要评论
本人对该知识点了解不深,本文采用Victor,再进一步!的文章,如果有人看到本页,请直接进入https://www.cnblogs.com/victor5230/p/5846832.html,浏览原文。 对于IE8及以上版本,例如: 1: <meta http-equiv="X-UA-Compati ...

 

对于ie8及以上版本,例如:

   1: <meta http-equiv="x-ua-compatible" content="ie=9; ie=8; ie=7" />

 

强制浏览器按照特定的版本标准进行渲染。但不支持ie7及以下版本。如果用分号(;)分隔,对于不同的浏览器版本就有不同的兼容性,例如

   1: <meta http-equiv="x-ua-compatible" content="ie=7; ie=9" />

 

以上就表明,将ie8和ie7按照ie7标准渲染,但是ie9还是按照ie9的标准渲染。它允许有不同的向后兼容水平。尽管在真实情况中,你只要选择一种版本:

   1: <meta http-equiv="x-ua-compatible" content="ie=8" />

 

 
这对于测试和维护会更加简单。而通常更加有用的方式就是进行仿真模拟
   1: <meta http-equiv="x-ua-compatible" content="ie=emulateie8" />

 

对于ie=edge

   1: <meta http-equiv="x-ua-compatible" content="ie=edge" />

 

这意味着,会强制浏览器按照最新的标准去渲染。就像在google’s cdn使用最新版本的jquery一样,这是按照最新版本,但也可能由于没有固定的版本而破坏你的布局。

最后,考虑下面这个

   1: <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />

 

添加”chrome=1“将允许站点在使用了谷歌浏览器内嵌框架(chrome frame)的客户端渲染,对于没有使用的,则没有任何影响。

for more information, , and if you want to learn about chromeframe (which i recommend) you can .

 

ps:x-ua-compatible是针对 ie8 版本的一个特殊文件头标记,用于为 ie8 指定不同的页面渲染模式,对于ie8之外的浏览器是不识别的。

目前绝大多数网站都用<meta http-equiv=”x-ua-compatible” content=”ie=emulateie7″ >来作为ie8的兼容方法。为了避免制作出的页面在ie8下面出现错误,建议直接将ie8使用ie7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:

<meta http-equiv=”x-ua-compatible” content=”ie=7″ />

<meta http-equiv=”x-ua-compatible” content=”ie=emulateie7″ >

<meta http-equiv=”x-ua-compatible” content=”ie=emulateie8″ >

但是<meta http-equiv=”x-ua-compatible” content=”ie=emulateie7″ >仍然是首选。

stackoverflow原链接;http://stackoverflow.com/questions/14611264/x-ua-compatible-content-ie-9-ie-8-ie-7-ie-edge?answertab=active#tab-top

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网