X-UA-Compatible设置为IE = edge,但它仍然不会停止兼容模式 [英] X-UA-Compatible is set to IE=edge, but it still doesn't stop Compatibility Mode

查看:1423
本文介绍了X-UA-Compatible设置为IE = edge,但它仍然不会停止兼容模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑。我应该可以设置

I am quite confused. I should be able to set

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

和IE8和IE9应该使用最新的渲染引擎渲染页面。但是,我刚刚对其进行了测试,如果在我们网站的其他地方打开兼容模式,它将继续用于我们的页面,即使我们应该强迫它不要。

and IE8 and IE9 should render the page using the latest rendering engine. However, I just tested it, and if Compatibility Mode is turned on elsewhere on our site, it will stay on for our page, even though we should be forcing it not to.

你应该如何确保IE 使用兼容模式(即使在内联网中)?

How are you supposed to make sure IE does not use Compatibility Mode (even in an intranet)?

FWIW,我使用HTML5 DocType声明(<!doctype html> )。

FWIW, I am using the HTML5 DocType declaration (<!doctype html>).

以下是该页面的前几行:

Here are the first few lines of the page:

<!doctype html> 
<!--[if lt IE 7 ]> <html lang="en" class="innerpage no-js ie6"> <![endif]--> 
<!--[if IE 7 ]>    <html lang="en" class="innerpage no-js ie7"> <![endif]--> 
<!--[if IE 8 ]>    <html lang="en" class="innerpage no-js ie8"> <![endif]--> 
<!--[if (gte IE 9)|!(IE)]><!--> 
<html lang="en" class="innerpage no-js"> 
<!--<![endif]--> 
    <head> 
        <meta charset="ISO-8859-1" /> 
        <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 

编辑:我刚刚了解到IE8的默认设置是对Intranet站点使用IE7兼容模式。这会覆盖X-UA兼容元标记吗?

I just learned that the default setting on IE8 is to use IE7 compatibility mode for intranet sites. Would this override the X-UA-Compatible meta tag?

推荐答案

如果您需要覆盖IE的Intranet网站的兼容性视图设置可以在web.config(IIS7)中或通过自定义HTTP标头执行此操作在网站的属性(IIS6)中设置X-UA-Compatible。兼容性视图设置中的元标记不会覆盖IE的Intranet设置,但如果您在托管服务器上设置它,它将覆盖兼容性。

If you need to override IE's Compatibility View Settings for intranet sites you can do so in the web.config (IIS7) or through the custom HTTP headers in the web site's properties (IIS6) and set X-UA-Compatible there. The meta tag doesn't override IE's intranet setting in Compatibility View Settings, but if you set it at the hosting server it will override the compatibility.

web.config的示例在IIS7中:

Example for web.config in IIS7:

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-UA-Compatible" value="IE=EmulateIE8" />
      </customHeaders>
    </httpProtocol>
</system.webServer>

编辑:我删除了清除代码来自添加之前;复制和粘贴是一种不必要的疏忽。好评,评论者!

Edit: I removed the clear code from just before the add; it was an unnecessary oversight from copying and pasting. Good catch, commenters!

这篇关于X-UA-Compatible设置为IE = edge,但它仍然不会停止兼容模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆