Html "X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE"

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14611264/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 05:21:13  来源:igfitidea点击:

"X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE"

htmlinternet-explorerx-ua-compatible

提问by Kuttan Sujith

<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
  1. Actually what is the meaning of this statement ?

  2. Some of the examples use ,to separate versions of IE, while some use ;; which is correct?

  3. The order IE=9; IE=8; IE=7; IE=EDGEhas some importance, I wish to know that.

  1. 其实这句话的意思是什么?

  2. 一些示例用于,分隔 IE 的版本,而另一些则使用;; 哪个是正确的?

  3. 顺序IE=9; IE=8; IE=7; IE=EDGE有一定的重要性,我想知道。

Edit: I am using <!DOCTYPE html>

编辑:我正在使用<!DOCTYPE html>

回答by PlantTheIdea

If you support IE, for versions of Internet Explorer 8 and above, this:

如果您支持 IE,对于 Internet Explorer 8 及更高版本,此:

<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7" />

Forces the browser to render as that particular version's standards. It is not supported for IE7 and below.

强制浏览器呈现为该特定版本的标准。IE7 及以下不支持。

If you separate with semi-colon, it sets compatibility levels for different versions. For example:

如果用分号分隔,它会设置不同版本的兼容性级别。例如:

<meta http-equiv="X-UA-Compatible" content="IE=7; IE=9" />

Renders IE7 and IE8 as IE7, but IE9 as IE9. It allows for different levels of backwards compatibility. In real life, though, you should only chose one of the options:

将 IE7 和 IE8 呈现为 IE7,但将 IE9 呈现为 IE9。它允许不同级别的向后兼容性。但是,在现实生活中,您应该只选择以下选项之一:

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

This allows for much easier testing and maintenance. Although generally the more useful version of this is using Emulate:

这使得测试和维护更加容易。虽然通常更有用的版本是使用 Emulate:

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

For this:

为了这:

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

It forces the browser the render at whatever the most recent version's standards are.

它强制浏览器以最新版本的标准进行渲染。

For more information, there is plenty to read about on MSDN,

有关更多信息,请参阅 MSDN 上的大量内容

回答by Ujjwal Singh

In certain cases, it might be necessary to restrict the display of a webpage to a document mode supported by an earlier version of Internet Explorer. You can do this by serving the page with an x-ua-compatible header. For more info, see Specifying legacy document modes.
- https://msdn.microsoft.com/library/cc288325

在某些情况下,可能需要将网页的显示限制为早期版本的 Internet Explorer 支持的文档模式。您可以通过为页面提供与 x-ua 兼容的标头来实现此目的。有关详细信息,请参阅指定旧文档模式。
- https://msdn.microsoft.com/library/cc288325

Thus this tag is used to future proofthe webpage, such that the older/ compatibleengine is used to render it the same way as intended by the creator.

因此,此标签用于对网页进行未来验证,以便使用较旧的/兼容引擎以与创建者预期的方式相同的方式呈现它。

Make sure that you have checked it to work properly with the IE version you specify.

确保您已检查它是否与您指定的 IE 版本一起正常工作。