X-UA-Compatible是针对IE8新加的一个设置,对于IE8之外的浏览器是不识别的,这个区别与content="IE=7"在无论页面是否包含<!DOCTYPE>指令,都像是使用了 Windows Internet Explorer 7的标准模式。而content="IE=EmulateIE7"模式遵循<!DOCTYPE>指令。对于多数网站来说,它是首选的兼容性模式。
为了避免制作出的页面在IE8下面出现错误,建议直接将IE8使用IE7进行渲染。也就是直接在页面的header的meta标签中加入如下代码:
<meta http-equiv="X-UA-Compatible" content="IE=7" />
这样我们才能使得页面在IE8里面表现正常!
浏览器市场份额的激烈竞争,给网页设计开发人员带来了兼容性设计的麻烦。仅IE浏览器就有好几个主流版本,IE6、IE7、IE8 等等。当然使用诸如 IETester,多版本 IE 共存解决方案之类的第三方集成工具,可以方便代码调试。但我们总需要找寻一种更为省时省力的方法。
X-UA-Compatible 是针对 IE8 版本的一个特殊文件头标记,用于为 IE8 指定不同的页面渲染模式。由于当下 IE6 和 IE7 使用率依然较高,综合考虑,启用 IE8 版本的 X-UA-Compatible 兼容模式显得相当重要。
各种兼容模式代码示例如下:
1.<meta http-equiv="X-UA-Compatible" content="IE=5" />
像是使用了 Windows Internet Explorer 7 的 Quirks 模式,这与 Windows Internet Explorer 5 显示内容的方式很相似。
2.<meta http-equiv="X-UA-Compatible" content="IE=7" />
无论页面是否包含 <!DOCTYPE> 指令,均使用 Windows Internet Explorer 7 的标准渲染模式。
3.<meta http-equiv="X-UA-Compatible" content="IE=8" />
开启 IE8 的标准渲染模式,但由于本身 X-UA-Compatible 文件头仅支持 IE8 以上版本,因此等同于冗余代码。
4.<meta http-equiv="X-UA-Compatible" content="edge" />
Edge 模式通知 Windows Internet Explorer 以最高级别的可用模式显示内容,这实际上破坏了“锁定”模式。即如果你有IE9的话说明你有IE789,那么就调用高版本的那个也就是IE9。
5.<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
如果IE有安装Google Chrome Frame,那么就走安装的组件,如果没有就和<meta http-equiv="X-UA-Compatible" content="edge" />一样。
说明:针对IE 6,7,8等版本的浏览器插件Google Chrome Frame,可以让用户的浏览器外观依然是IE的菜单和界面,但用户在浏览网页时,实际上使用的是Google Chrome浏览器内核。
6.<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
EmulateIE7 模式通知 Windows Internet Explorer 使用 <!DOCTYPE> 指令确定如何呈现内容。标准模式指令以Windows Internet Explorer 7 标准模式显示,而 Quirks 模式指令以 IE5 模式显示。与 IE7 模式不同,EmulateIE7 模式遵循 <!DOCTYPE> 指令。对于多数网站来说,它是首选的兼容性模式。
目前,在开发AngularJS项目时(只支持IE8及以上版本或chrome/firefox),而有些同事IE8登录却还提示“请使用IE8及以上版本或chrome/firefox,如果您使用IE8,请在”工具”菜单中,调整为非”兼容性视图”!
解决方法:
相关推荐
DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> ...
meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″> 但令我好奇的是,此处这个标记后面竟然出现了chrome这样的值,难道IE也可以模拟chrome了? 迅速搜索了一下,才明白原来不是微软增强了IE,...
DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>...
meta http-equiv=X-UA-Compatible content=IE=edge> <meta name='viewport' content='width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no'> <link href=...
实例 <!DOCTYPE html> <... ...meta http-equiv=X-UA-Compatible content=ie=edge> <title>Vue的属性、方法和生命周期</title> [removed][removed] </head> <bod
meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap....
Vue.js 组件 ...meta http-equiv=X-UA-Compatible content=IE=edge> <title>Page Title</title> <meta name=viewport content=width=device-width, initial-scale=1> <scrip
我们一般通过node框架提供的api操作页面渲染,如何利用原始回写的方式来实现同样的功能呢 下面是通过node 提供的异步地读取一个文件的全部内容api readFile...meta http-equiv=X-UA-Compatible content=ie=edge>
本文实例为大家分享了Vue.js标签页组件使用的具体代码,供大家参考,具体内容如下 ...meta http-equiv=X-UA-Compatible content=ie=edge> <title>标签页组件</title> <link rel=stylesheet t
meta http-equiv=X-UA-Compatible content=IE=edge,chrome=1> <title>Examples</title> [removed][removed] </head> <body> <div id=app> <!-- post-title使用驼峰命名postTitle会...
分享给大家供大家参考,具体...meta http-equiv=X-UA-Compatible content=IE=edge> <meta name=viewport content=width=device-width, initial-scale=1> <title><%= title %></title>
本文实例为大家分享了Vue.js下拉菜单组件的具体实现代码,供大家参考,具体内容如下 ...meta http-equiv=X-UA-Compatible content=ie=edge> <title>可从外部关闭的下拉菜单</title> <link rel=
具体代码如下所述: ...meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> [removed] //js函数的书写 function myFunction() {
meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Document</title> <link rel="stylesheet" href...
拼接table请将以下代码直接运行:换下 bootstrap.css jquery-1.12.3.min....meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=" /> <meta name="viewport" content="width=device-width, initial-scal
默认插槽和具名插槽的概念比较好理解,这里主要以官方文档的案例来讲解一下作用域插槽。...meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <bod
1.要用bootStrap这个框架就必须要重载它的class类,也就是说class要一样 代码如下: 有疑问的可以在下面留言,欢迎大家...meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title
最近一个小项目,在最后的测试阶段出现了问题,使用了Vue,在Chrome、Firefox、Safari、IE11下都可以访问,唯独IE9下无法正常显示,排除程序问题后,最终判断是...meta http-equiv="X-UA-Compatible" content="IE=edge
本文实例为大家分享了Vue.js数字输入框组件的具体实现代码,供大家参考,具体...meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>数字输入框组件</title> </head> <body>
表单作为Bootstrap的核心内容,...meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- 移动设备优先 --> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--