IE 定义文档兼容性
2013-09-14 11:26
232 查看
1. 指定文档兼容性模式
若要为网页指定文档模式,请使用 meta 元素,以在网页中包含 X-UA-Compatible http-equiv 标头
2. 配置 Web 服务器以指定默认兼容性模式
如果使用 Web 服务器指定了默认的文档兼容性模式,则可通过在特定的网页中指定不同的文档兼容性模式来覆盖默认设置。 在网页中指定的模式优先于由 Web 服务器指定的模式。
有关如何指定自定义标头的信息
3. 确定文档兼容性模式
4. content 的属性值
如果某个特定的 Internet Explorer 版本支持多个请求的兼容性模式,则该版本将使用标头的 content 属性中列出的可用的最高级别模式。 可以利用这一原理来排除特定的兼容性模式,但不建议这样做。 例如,下面的标头排除了 IE7 模式
若要为网页指定文档模式,请使用 meta 元素,以在网页中包含 X-UA-Compatible http-equiv 标头
<html> <head> <!-- Mimic Internet Explorer 7 --> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" > <title>My Web Page</title> </head> <body> <p>Content goes here.</p> </body> </html>
2. 配置 Web 服务器以指定默认兼容性模式
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <httpProtocol> <customHeaders> <clear /> <add name="X-UA-Compatible" value="IE=EmulateIE7" /> </customHeaders> </httpProtocol> </system.webServer> </configuration>
如果使用 Web 服务器指定了默认的文档兼容性模式,则可通过在特定的网页中指定不同的文档兼容性模式来覆盖默认设置。 在网页中指定的模式优先于由 Web 服务器指定的模式。
有关如何指定自定义标头的信息
3. 确定文档兼容性模式
engine = null; if (window.navigator.appName == "Microsoft Internet Explorer") { // This is an IE browser. What mode is the engine in? if (document.documentMode) // IE8 engine = document.documentMode; else // IE 5-7 { engine = 5; // Assume quirks mode unless proven otherwise if (document.compatMode) { if (document.compatMode == "CSS1Compat") engine = 7; // standards mode } } // the engine variable now contains the document compatibility mode. }
4. content 的属性值
<meta http-equiv="X-UA-Compatible" content="IE=4"> <!-- IE5 mode --> <meta http-equiv="X-UA-Compatible" content="IE=7.5" > <!-- IE7 mode --> <meta http-equiv="X-UA-Compatible" content="IE=100" > <!-- IE8 mode --> <meta http-equiv="X-UA-Compatible" content="IE=a" > <!-- IE5 mode -->
如果某个特定的 Internet Explorer 版本支持多个请求的兼容性模式,则该版本将使用标头的 content 属性中列出的可用的最高级别模式。 可以利用这一原理来排除特定的兼容性模式,但不建议这样做。 例如,下面的标头排除了 IE7 模式
<meta http-equiv="X-UA-Compatible" content="IE=5; IE=8" >
相关文章推荐
- 定义文档兼容性、让IE按指定版本解析我们的页面
- 定义文档兼容性,让IE按指定的版本解析我们的页面
- (转自Mitchell Chu's Blog)定义文档兼容性,让IE按指定的版本解析我们的页面
- 定义文档兼容性,让IE按指定的版本解析页面
- IE定义文档兼容性
- 定义文档兼容性,让IE按指定的版本解析我们的页面
- 定义文档兼容性,让IE按照指定的浏览器版本解析页面
- 定义文档兼容性,让IE按指定的版本解析我们的页面
- 定义文档兼容性,让IE按指定的版本解析我们的页面
- 定义文档兼容性,让IE按指定的版本解析我们的页面
- 定义IE的文档兼容模式
- 定义文档兼容性,是浏览器兼容各个版本号
- 定义文档兼容性
- IE浏览器:定义文档兼容性
- 如何定义IE的文档兼容模式
- IE对文档的解析模式及兼容性问题
- IE中的文档兼容性
- IE8定义文档兼容性
- telerik 控件 SCRIPT5007: 无法获取未定义或 null 引用的属性“documentElement” (IE 文档模式)
- IE8 定义文档兼容性