&是什么LT; META HTTP-当量=" X-UA兼容"内容= QUOT; IE =边缘">做? [英] What does <meta http-equiv="X-UA-Compatible" content="IE=edge"> do?

查看:310
本文介绍了&是什么LT; META HTTP-当量=" X-UA兼容"内容= QUOT; IE =边缘">做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么区别,如果一个网页以

What's the difference if one web page starts with

<!DOCTYPE html> 
<html> 
  <head> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 

和页面如果开头

<!DOCTYPE html> 
<html> 
  <head> 
     <!-- without X-UA-Compatible meta -->

如果没有区别,我想我可以忽略 X-UA兼容元的头,因为我只是希望它在大多数标准模式呈现在所有IE版本。

If there is no difference, I suppose I can just ignore the X-UA-Compatible meta header, since I just want it to be rendered in most standard mode in all IE versions.

推荐答案

2015年10月更新

October 2015 Update

这答案是几年前发布,现在真正的问题应该是,你甚至应该考虑使用 X-UA兼容标签在您的网站与改变微软它的浏览器(更多低于)制成。

This answer was posted several years ago and now the question really should be should you even consider using the X-UA-Compatible tag on your site with the changes Microsoft has made to its browsers (more on those below).

取决于微软的浏览器是否支持你可能不需要继续使用 X-UA兼容标记。如果需要支持IE 9或IE 8,那么我会建议使用的标记。如果你只支持最新的浏览器(IE 11和/或边缘),那么我会考虑放弃干脆此标记。以下附加信息:

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. Additional info below:

在X-UA兼容meta标记允许Web作者将选择什么版本的Internet Explorer的页面应该呈现为。 IE11已经更改了这些模式;请参阅下面的IE11注释。 微软边缘,将IE11之后发布的浏览器中,将只兑现了X-在某些情况下UA兼容meta标签。请参阅下面的微软边缘音符。

The X-UA-Compatible meta tag allows web authors to choose what version of Internet Explorer the page should be rendered as. IE11 has made changes to these modes; see the IE11 note below. Microsoft Edge, the browser that will be released after IE11, will only honor the X-UA-Compatible meta tag in certain circumstances. See the Microsoft Edge note below.

据微软称,使用X-UA兼容的标签时,它应该是您的文档中尽可能高

According to Microsoft, when using the X-UA-Compatible tag, it should be as high as possible in your document head:

如果您使用的是你想将它放在靠近网页的HEAD尽可能顶部的X-UA-兼容META标记。 Internet Explorer中开始使用最新版本的跨preting标记。当Internet Explorer遇到X-UA-兼容META标记它开始在使用指定版本的引擎。这是一个性能下降,因为浏览器必须停止并重新启动分析内容。

If you are using the X-UA-Compatible META tag you want to place it as close to the top of the page's HEAD as possible. Internet Explorer begins interpreting markup using the latest version. When Internet Explorer encounters the X-UA-Compatible META tag it starts over using the designated version's engine. This is a performance hit because the browser must stop and restart analyzing the content.

下面是你的选择:


  • IE =边缘

  • IE = 11

  • IE = EmulateIE11

  • IE = 10

  • IE = EmulateIE10

  • IE = 9

  • IE = EmulateIE9

  • IE = 8

  • IE = EmulateIE8

  • IE = 7

  • IE = EmulateIE7

  • IE = 5

要试图了解每种方法,下面是由微软提供的定义:

To attempt to understand what each means, here are definitions provided by Microsoft:

Internet Explorer支持若干文件兼容模式,使不同的特征,并且可能影响显示内容的方式:

Internet Explorer supports a number of document compatibility modes that enable different features and can affect the way content is displayed:


      
  • EDGE模式告诉Internet Explorer显示在可用的最高模式的内容。使用Internet Explorer 9,这相当于IE9模式。如果未来发行的Internet Explorer支持更高的兼容性模式,页面设置为边缘模式将出现在由该版本支持的最高模式。使用Internet Explorer 9查看时,这些相同的页面仍然会出现在IE9模式。
      Internet Explorer支持的一些文档兼容性模式,让不同的功能,并且会影响显示内容的方式:

  • Edge mode tells Internet Explorer to display content in the highest mode available. With Internet Explorer 9, this is equivalent to IE9 mode. If a future release of Internet Explorer supported a higher compatibility mode, pages set to edge mode would appear in the highest mode supported by that version. Those same pages would still appear in IE9 mode when viewed with Internet Explorer 9. Internet Explorer supports a number of document compatibility modes that enable different features and can affect the way content is displayed:

IE11模式提供了可用于建立新的行业标准,包括HTML5,CSS3和其他人的最高支持。

IE11 mode provides the highest support available for established and emerging industry standards, including the HTML5, CSS3 and others.

IE10模式提供了可用于建立新的行业标准,包括HTML5,CSS3和其他人的最高支持。

IE10 mode provides the highest support available for established and emerging industry standards, including the HTML5, CSS3 and others.

IE9模式提供了可用于建立新的行业标准,包括HTML5(工作草案),W3C层叠样式表级别3规格(工作草案),可伸缩矢量图形(SVG)1.0规范中的最高支持,其他。 [编者注:IE 9的的支持CSS3动画。

IE9 mode provides the highest support available for established and emerging industry standards, including the HTML5 (Working Draft), W3C Cascading Style Sheets Level 3 Specification (Working Draft), Scalable Vector Graphics (SVG) 1.0 Specification, and others. .

IE8模式支持许多既定的标准,包括W3C层叠样式表级别2.1规范和W3C选择器API;它还提供了对W3C层叠样式表级别3规格(工作草案)的支持有限等新兴标准。

IE8 mode supports many established standards, including the W3C Cascading Style Sheets Level 2.1 Specification and the W3C Selectors API; it also provides limited support for the W3C Cascading Style Sheets Level 3 Specification (Working Draft) and other emerging standards.

IE7模式呈现的内容,该网页是否包含一个指令。

IE7 mode renders content as if it were displayed in standards mode by Internet Explorer 7, whether or not the page contains a directive.

仿效​​IE9模式告诉Internet Explorer以使用该指令来决定如何呈现内容。标准模式指令显示在IE9模式和怪癖模式指令显示在IE5模式。与IE9模式,模拟IE9模式尊重指令。

Emulate IE9 mode tells Internet Explorer to use the directive to determine how to render content. Standards mode directives are displayed in IE9 mode and quirks mode directives are displayed in IE5 mode. Unlike IE9 mode, Emulate IE9 mode respects the directive.

仿效​​IE8模式告诉Internet Explorer以使用该指令来决定如何呈现内容。标准模式指令显示在IE8模式和怪癖模式指令显示在IE5模式。与IE8模式,模仿IE8模式尊重指令。

Emulate IE8 mode tells Internet Explorer to use the directive to determine how to render content. Standards mode directives are displayed in IE8 mode and quirks mode directives are displayed in IE5 mode. Unlike IE8 mode, Emulate IE8 mode respects the directive.

仿效​​IE7模式告诉Internet Explorer以使用该指令来决定如何呈现内容。标准模式指令显示在Internet Explorer 7的标准模式和怪癖模式指令显示在IE5模式。与IE7模式,模仿IE7模式尊重指令。对于很多网站来说,这是preferred兼容模式。

Emulate IE7 mode tells Internet Explorer to use the directive to determine how to render content. Standards mode directives are displayed in Internet Explorer 7 standards mode and quirks mode directives are displayed in IE5 mode. Unlike IE7 mode, Emulate IE7 mode respects the directive. For many web sites, this is the preferred compatibility mode.

IE5模式呈现的内容5。

IE5 mode renders content as if it were displayed in quirks mode by Internet Explorer 7, which is very similar to the way content was displayed in Microsoft Internet Explorer 5.

IE 10注:与Internet Explorer 10,怪癖模式行为不同于在早期版本的浏览器一样。在Windows Internet Explorer 9和早期版本中,怪癖模式制约了网页,由Microsoft Internet Explorer 5.5支持的功能。在Internet Explorer 10,怪癖模式符合在HTML5规范中规定的不同之处。

IE 10 NOTE: As of Internet Explorer 10, quirks mode behaves differently than it did in earlier versions of the browser. In Windows Internet Explorer 9 and earlier versions, quirks mode restricted the webpage to the features supported by Microsoft Internet Explorer 5.5. In Internet Explorer 10, quirks mode conforms to the differences specified in the HTML5 specification.

就个人而言,我总是选择 HTTP的当量=X-UA-Compatible的内容=IE =边缘 meta标签,旧版本有大量的bug ,我不想IE来决定进入兼容模式,并显示我的网站IE7 IE8 VS或9我总是preFER IE浏览器的最新版本。

Personally, I always choose the http-equiv="X-UA-Compatible" content="IE=edge" meta tag, as older versions have plenty of bugs, and I do not want IE to decide to go into "Compatibility mode" and show my site as IE7 vs IE8 or 9. I always prefer the latest version of IE.

IE 11

IE 11

微软:

与IE11开始,边模式是preferred文档模式;它重新presents可用到浏览器的现代化标准最高的支持。

Starting with IE11, edge mode is the preferred document mode; it represents the highest support for modern standards available to the browser.

使用HTML5的文档类型声明,使边缘模式:

Use the HTML5 document type declaration to enable edge mode:

&LT;!DOCTYPE HTML&GT;

EDGE模式在Internet Explorer 8中引入的,并在每个后续版本已经可用。注意,由边缘模式所支持的特征限制为那些由浏览器中呈现的内容的特定版本的支持。

Edge mode was introduced in Internet Explorer 8 and has been available in each subsequent release. Note that the features supported by edge mode are limited to those supported by the specific version of the browser rendering the content.

与IE11开始,文档模式是德precated,应该不再被使用,除了临时的基础上。请务必更新依赖于原有的功能和文档模式的网站,以反映现代标准。

Starting with IE11, document modes are deprecated and should no longer be used, except on a temporary basis. Make sure to update sites that rely on legacy features and document modes to reflect modern standards.

如果让您的网站的功能,而你返工,支持现代标准和功能,要知道,你正在使用一个过渡性的特征,一个可能无法在未来版本中,你必须针对特定文档模式。

If you must target a specific document mode so that your site functions while you rework it to support modern standards and features, be aware that you're using a transitional feature, one that may not be available in future versions.

如果您目前使用的X-UA-Compatible标头的目标遗留文档模式,有可能你的网站将不会反映IE11提供最佳体验。

If you currently use the x-ua-compatible header to target a legacy document mode, it's possible your site won't reflect the best experience available with IE11.

微软边缘(更换为Internet Explorer自带与Windows 10)捆绑

Microsoft Edge (Replacement for Internet Explorer that comes bundled with Windows 10)

这是X-UA-兼容meta标记为IE的边缘的版本信息。 <一href=\"http://blogs.msdn.com/b/ie/archive/2014/11/11/living-on-the-edge-our-next-step-in-interoperability.aspx\">From微软:

Information on X-UA-Compatible meta tag for the "Edge" version of IE. From Microsoft:

介绍活Edge文档模式

正如我们2013年8月宣布,我们是去precating文档模式的IE11的。随着我们最新的平台更新,需要对原有文档模式基本局限于传统的企业网络应用程序。随着新的建筑的变化,这些遗留文档模式将在生活EDGE模式的变化,这将有助于保证其兼容性,对谁依靠这些模式的客户提供更高水平,帮助我们更快前进的边缘改善隔离。 IE浏览器的下一个主要版本还是会履行兼容性视图列表上通过Intranet站点提供文档模式,站点,并与企业模式下使用时只。

As we announced in August 2013, we are deprecating document modes as of IE11. With our latest platform updates, the need for legacy document modes is primarily limited to Enterprise legacy web apps. With new architectural changes, these legacy document modes will be isolated from changes in the "living" Edge mode, which will help to guarantee a much higher level of compatibility for customers who depend on those modes and help us move even faster on improvements in Edge. The next major version of IE will still honor document modes served by intranet sites, sites on the Compatibility View list, and when used with Enterprise Mode only.

公共互联网网站将使用新的边沿模式的平台渲染(忽略X-UA-兼容)。这是我们的目标是Edge是活的文件模式下,从这里走出,并会推出没有进一步的文档模式向前发展。

Public Internet sites will be rendered with the new Edge mode platform (ignoring X-UA-Compatible). It is our goal that Edge is the "living" document mode from here out and no further document modes will be introduced going forward.

使用在大多数情况下不再支持文档模式的变化,微软边缘,微软有一个工具来扫描你的网站检查,看看是否有code,是不是与边缘兼容。

With the changes in Microsoft Edge to no longer support document modes in most cases, Microsoft has a tool to scan your site to check and see if it has code that is not compatible with Edge.

铬= 1的信息即

Chrome=1 Info for IE

还有铬= 1 ,您可以使用或与上述选项,EX一起使用:&LT; META HTTP-当量=X-UA-Compatible的内容=IE =边缘,镀铬= 1&GT; 铬= 1 是谷歌的Chrome框架,其定义为:

There is also chrome=1 that you can use or use together with one of the above options, EX: <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> chrome=1 is for Google's Chrome Frame which is defined as:

谷歌浏览器内嵌框架是一个开源的浏览器插件。谁安装了该插件的用户可以访问谷歌浏览器的开放式网络技术和快速的JavaScript引擎,当他们打开浏览器页面。

Google Chrome Frame is an open source browser plug-in. Users who have the plug-in installed have access to Google Chrome's open web technologies and speedy JavaScript engine when they open pages in the browser.

谷歌Chrome Frame的无缝提高Internet Explorer的浏览体验。它显示使用谷歌Chrome浏览器的渲染技术,谷歌Chrome Frame的启用站点,让您使用最新的HTML5功能,以及谷歌Chrome的性能和安全功能,不以任何方式打扰你平常的浏览器使用。

Google Chrome Frame seamlessly enhances your browsing experience in Internet Explorer. It displays Google Chrome Frame enabled sites using Google Chrome’s rendering technology, giving you access to the latest HTML5 features as well as Google Chrome’s performance and security features without in any way interrupting your usual browser usage.

当安装了谷歌浏览器内嵌框架,网络只会越来越没有你不必去想它。

When Google Chrome Frame is installed, the web just gets better without you having to think about it.

但对于插件工作,你必须使用铬= 1 在X-UA兼容meta标签。

But for that plug-in to work you must use chrome=1 in the X-UA-Compatible meta tag.

Chrome Frame的可以在这里找到的更多信息。

注意:谷歌Chrome Frame的,只有通过适用于 IE6 IE9 以及退休了2月25日,2014年更多信息可以在这里找到。感谢您@mck的链接。

Note: Google Chrome Frame only works for IE6 through IE9, and was retired on February 25, 2014. More info can be found here. Thank You @mck for the link.

验证:

Validation:

HTML5

该页面将验证使用使用时W3仅验证 &LT; META HTTP-EQUIV =X -ua兼容内容=IE =边缘&GT; 。对于其他值就会抛出错误:与HTTP-equiv属性的值是X-UA-兼容必须与值IE =边缘的内容属性的meta元素换句话说,如果你有 IE =边缘,镀铬= 1 它不会验证。我忽略这个错误完全是现代的浏览器简单地忽略此行code的。

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.

如果您必须拥有完全有效的code,则考虑通过设置HTTP头中的服务器级别这样做。作为一个说明,微软表示,如果这两个指令发送(元和HTTP),开发商的preference(元元)花费precedence在Web服务器设置(HTTP报头) 见olibre的回答或bitinn的的答案关于如何设置HTTP标头的详细信息。

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.

XHTML

有使用的时候是不带验证问题&LT; META HTTP-EQUIV =X-UA-Compatible的内容=IE =边缘/&GT; 只要标签被正确关闭,IE浏览器: /&GT; VS &GT;

There isn't an issue with validation when using <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> as long as the tag is properly closed, IE: /> vs >

有关X-UA-兼容请参阅Microsoft的网站定义的详细信息文档兼容性

For more information on X-UA-Compatible see Microsoft's Website Defining Document Compatibility.

有关什么IE支持见网站 caniuse.com

For more information on what IE supports see the website caniuse.com

这篇关于&是什么LT; META HTTP-当量=&QUOT; X-UA兼容&QUOT;内容= QUOT; IE =边缘&QUOT;&GT;做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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