http-equiv=”X-UA-Compatible” content=”ie-edge”


这个主要是给微软家的浏览器用的,用来告诉Internet Explorer要在哪个版本的IE上Render。对于想支持IE8、IE9这样的旧版本,是需要用到这个标签。但对于IE11或Edge,这个已经不需要了。

Depending upon what Microsoft browsers you support you may not need to continue using the X-UA-Compatible tag. If you need to support IE 9 or IE 8, then I would recommend using the tag. If you only support the latest browsers (IE 11 and/or Edge) then I would consider dropping this tag altogether. If you use Twitter Bootstrap and need to eliminate validation warnings, this tag must appear in its specified order.



The page will validate using the W3 Validator only when using <meta http-equiv="X-UA-Compatible" content="IE=Edge">. For other values it will throw the error: A meta element with an http-equiv attribute whose value is X-UA-Compatible must have a content attribute with the value IE=edge. In other words, if you have IE=edge,chrome=1 it will not validate. I ignore this error completely as modern browsers simply ignore this line of code.

If you must have completely valid code then consider doing this on the server level by setting HTTP header. As a note, Microsoft says, If both of these instructions are sent (meta and HTTP), the developer's preference (meta element) takes precedence over the web server setting (HTTP header). See olibre’s answer or bitinn’s answer for more details on how to set an HTTP header.

What does <meta http-equiv=“X-UA-Compatible” content=“IE=edge”> do?