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

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

IE8和IE9应该使用最新的渲染引擎来渲染页面。但是,我刚刚测试了它,如果兼容性模式在我们网站的其他地方被打开,它将为我们的页面保持,即使我们应该强制它不这样做。

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

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

以下是这一页的前几行:

<!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的默认设置是内网站点使用IE7兼容模式。这会覆盖x - ua compatible元标记吗?


当前回答

蒂米·弗兰克斯很适合我。我们今天遇到了一个问题,客户在公司范围内使用IE8,这迫使我们为他们的内部网编写的网站进入兼容模式。设置“IE-Edge”似乎可以解决这个问题。

<httpProtocol>
  <customHeaders>
    <clear />
    <add name="X-UA-Compatible" value="IE=Edge" />
  </customHeaders>
</httpProtocol>

其他回答

我能够绕过这个加载头之前的HTML与php,它工作得很好。

<?php 
header( 'X-UA-Compatible: IE=edge,chrome=1' );
header( 'content: width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' );
include('ix.html');
?> 

ix.html是我在发送报头后想要加载的内容。

如果你正在使用LAMP堆栈,那么将其添加到web根文件夹中的.htaccess文件中。不需要将它添加到每个PHP文件中。

<IfModule mod_headers.c>
    Header add X-UA-Compatible "IE=Edge"
</IfModule>

当浏览器打开兼容模式时,即使您从web浏览器和本地组策略编辑器中删除并关闭所有兼容模式配置,您也可以尝试从注册键中禁用。

这也发生在我使用域和子域连接服务器端。机器被限制在兼容模式下为所有子域打开。

禁用内网兼容模式

HKEY_LOCAL_MACHINE - SOFTWARE - Policies - Microsoft - Internet Explorer - BrowserEmulation -> IntranetCompalityMode Value为0(0)。并从策略列表中删除现有域名。

否则,您可以添加一个包含0(零)值数据的新值(DWORD)。

在尝试了许多组合后,我有同样的问题,我有这个工作 注意我已经检查了内部网的兼容性

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<head runat="server">

对于Nginx,

add_header "X-UA-Compatible" "IE=Edge,chrome=1";

参考:https://github.com/h5bp/server-configs/commit/a5b0a8f736d68f7de27cdcb202e32975a74bd2c5