标题 | 关于ie8兼容:x-ua-compatible属性的解释 |
内容 | 问题描述: 复制代码代码如下:<meta http-equiv=x-ua-compatible content=ie=9; ie=8; ie=7; ie=edge /> 1、这个到底是什么意思? 2、一些示例使用”,”分离ie的版本,而一些使用”;“,哪个正确? 3、我想知道ie=9; ie=8; ie=7; ie=edge顺序的含义。 在文档中使用了<!doctype> 答复: 对于ie8及以上版本,例如: 复制代码代码如下:<meta http-equiv=x-ua-compatible content=ie=9; ie=8; ie=7 /> 强制浏览器按照特定的版本标准进行渲染。但不支持ie7及以下版本。如果用分号(;)分隔,对于不同的浏览器版本就有不同的兼容性,例如 复制代码代码如下:<meta http-equiv=x-ua-compatible content=ie=7; ie=9 /> 以上就表明,将ie8和ie7按照ie7标准渲染,但是ie9还是按照ie9的标准渲染。它允许有不同的向后兼容水平。尽管在真实情况中,你只要选择一种版本: 复制代码代码如下:<meta http-equiv=x-ua-compatible content=ie=8 /> 这对于测试和维护会更加简单。而通常更加有用的方式就是进行仿真模拟 复制代码代码如下:<meta http-equiv=x-ua-compatible content=ie=emulateie8 /> 对于ie=edge 复制代码代码如下:<meta http-equiv=x-ua-compatible content=ie=edge /> 这意味着,会强制浏览器按照最新的标准去渲染。就像在google’s cdn使用最新版本的jquery一样,这是按照最新版本,但也可能由于没有固定的版本而破坏你的布局。 最后,考虑下面这个 复制代码代码如下:<meta http-equiv=x-ua-compatible content=ie=edge,chrome=1 /> 添加”chrome=1“将允许站点在使用了谷歌浏览器内嵌框架(chrome frame)的客户端渲染,对于没有使用的,则没有任何影响。 复制代码代码如下: for more information, there is plenty to read here, and if you want to learn about chromeframe (which i recommend) you can learn about its implementation here. 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″ /></p> <p><meta http-equiv=”x-ua-compatible” content=”ie=emulateie7″ ></p> <p><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 |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。