1

This is the worst ... for some reason, my application is not working correctly because IE9 things that it's IE7 and automatically changes the Document Mode to IE7.

It's a really odd situation, because my PC does NOT do this. But it seems to be that those who have upgraded their IE from 7 or 8 to 9 get this behaviour... compatibility mode?

I have no idea what to do to ensure that IE renders the document properly!

enter image description here

Some more information on the matter ... it is absolutely because of Compatibility Mode. When this mode is turned on, the screenshot above applies. But when Developer Tools are opened, everything works.


NOTE: I just read somewhere that IE will not be able to process console.log() and this could be the issue! Is this possible?

4

4 回答 4

5

尝试设置此元标记

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

我在 IE8 及以下版本中使用谷歌浏览器框架

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8">

另请参阅http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspxhttp://456bereastreet.com/archive/201103/x-ua-compatible_and_html5

编辑:正如 pocesar 在评论中所说,您的文档类型也设置不正确,应该是

<!doctype html>
于 2012-12-05T01:49:13.747 回答
2

IE11 自动将我网站的文档模式更改为“IE5”。我能够通过以下方式解决它,我希望这对某人有用。

我无法解释为什么,但如果我将元标记放在之后<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1">什么都不会发生,IE11 会将我的网站呈现为 IE5。

但是,如果我把它放在前面<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1">它可以工作,我网站的文档模式是最新的。

于 2014-02-25T16:14:38.073 回答
1

console.log是问题。显然 IE 只是不喜欢它,脚本会死。删除所有引用console.log,一切都很好。

于 2012-12-10T22:20:33.037 回答
1

你的文档类型应该是

<!doctype html>

而不是<!-- DOCTYPE html -->,这会破坏UA-Compatible标签的使用

另外,您应该将元标记放置为

<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">

或在您的 .htaccess 中

<IfModule mod_headers.c> 
  Header set X-UA-Compatible "IE=Edge,chrome=1" 
</IfModule>

(这些来自 HTML5 Boilerplate http://html5boilerplate.com/

于 2012-12-05T02:08:16.063 回答