简体   繁体   English

IE8兼容模式何时会表现为IE7?

[英]When will IE8 Compatibility mode behave as IE7?

I have been ask with IE8 Quirks mode by my team for compatibility with ERP software,I have done a little reading about quirks mode,I understand that it is meant to render the page as if it were rendering in IE5 where no libraries are supported.I have however heard that IE8 Compatibility Mode in the browser can run as IE7 in some cases. 我的团队向我询问了IE8 Quirks modeERP软件的兼容性,我对quirks模式做了一些阅读,我了解它的意思是像在IE5中渲染页面一样渲染页面,不支持任何库。但是,我听说浏览器中的IE8 Compatibility Mode在某些情况下可以作为IE7运行。

The software portal we use renders html within an iView forcing it to render in quirks mode .I have built html with the following style: 我们使用的软件门户网站在iView渲染html ,迫使其以quirks mode进行渲染。我使用以下样式构建了html

<doctype html>
<html lang="en">
   <head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     ....
     <body>
     ....
     <!-- load jQuery and other libraries followed by my code-->   
     </body>
</html>

Will this render as IE7 ,how can I find which mode it renders in and how can I force it render as IE8 or IE7? 可以将此渲染为IE7 ,如何找到它以哪种模式渲染,如何强制将其渲染为IE8或IE7?

First, to answer your questions: 首先,回答您的问题:

  1. It might render in IE7 mode, but that depends on how it's served, the security zone applied to the page, and a number of other environmental factors. 它可能以IE7模式呈现,但这取决于它的服务方式,应用于页面的安全区域以及许多其他环境因素。 Given the details in your post, I imagine it would not render in IE7 mode. 鉴于您的帖子中的详细信息,我想它不会在IE7模式下呈现。 (More below) (下面有更多内容)

  2. If you load a page in a recent version of IE, it's likely the page would render in edge mode (aka IE11 standards mode). 如果您在IE的最新版本中加载页面,则该页面很可能以边缘模式(也就是IE11标准模式)呈现。 You could check that by hitting F12 and reading the current document mode from the F12 tools toolbar area. 您可以通过单击F12并从F12工具工具栏区域读取当前文档模式来进行检查。 You can also use the window.document.documentMode property to determine the current document mode (if supported). 您还可以使用window.document.documentMode属性来确定当前文档模式(如果支持)。

  3. There are several ways to force it to various document modes. 有几种方法可以将其强制为各种文档模式。 In general, you have to use the x-ua-compatible header to specify the mode you want (eg content="IE=8" ). 通常,您必须使用x-ua-compatible头来指定所需的模式(例如, content="IE=8" )。 The value you've selected tells IE to use the highest mode available. 您选择的值告诉IE使用可用的最高模式。 Until the release of IE11, edge mode was considered experimental; 直到IE11发行,边缘模式才被认为是实验性的。 now it's preferred . 现在是首选

The reason why this might (or might not) render in IE7 mode depends on the way the page is being served. 可能(也可能不会)以IE7模式呈现的原因取决于页面的提供方式。 If it's being served in the Intranet zone and IE is set to display Intranet pages in compatibility view, then it's likely the page would render in IE7 mode. 如果在Intranet区域中提供服务,并且IE设置为在兼容性视图中显示Intranet页面,则该页面很可能以IE7模式呈现。 Having said that, the larger environment you described may mean the page isn't rendered in IE7 mode. 话虽如此,您描述的较大环境可能意味着该页面未在IE7模式下呈现。

Iframes affect the equation. iframe会影响方程式。 If your ASP page renders the Iview as an iframe, the result depends on the parent document. 如果您的ASP页将Iview呈现为iframe,则结果取决于父文档。 If the parent document is rendered in quirks mode, the child document is rendered in quirks mode. 如果父文档以怪异模式呈现,则子文档以怪异模式呈现。 (At least that's for recent versions of IE; things change in earlier versions ). (至少是针对IE的最新版本; 在早期版本中情况有所变化)。

So if the code you provide is in an iframe, the result will depend on the document mode of the page containing the iframe. 因此,如果您提供的代码在iframe中,则结果将取决于包含iframe的页面的文档模式。

Now, to control the situation, you should take some time to read up on the nitty gritty details . 现在,为了控制这种情况,您应该花一些时间来仔细阅读那些细碎的细节 Next, you may wish to add some debugging code to your code to display the current document mode once the page is rendered, so that you can test the results of different experiments. 接下来,您可能希望在代码中添加一些调试代码,以在呈现页面后显​​示当前文档模式,以便您可以测试不同实验的结果。

Remember that you don't necessarily need to place the x-ua-compatible within the page. 请记住,您不一定需要在页面中放置x-ua-compatible。 (You can use group policy or have the server send headers .) (您可以使用组策略或让服务器发送标头 。)

Finally, if you have Windows 8.1 Update installed, you might want to give try Enterprise IE (EMIE) a try. 最后,如果您安装了Windows 8.1 Update,则可能需要尝试使用Enterprise IE(EMIE) That forces IE11 into an IE8 mode that more accurately emulates the behavior of IE8 than the IE8 document mode does. 这迫使IE11进入IE8模式,比IE8文档模式更准确地模拟IE8的行为。

I know this is general, but the answers you're looking for depend greatly on the specific details you're working with. 我知道这很笼统,但是您要寻找的答案在很大程度上取决于您使用的具体细节。 Hopefully, this will nudge you in the right direction. 希望这会在正确的方向上推动您。

Hope this helps... 希望这可以帮助...

-- Lance -兰斯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM