简体   繁体   中英

IE9L Automatically changing Document Mode to IE7

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!

在此处输入图片说明

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?

Trying setting this meta tag

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

I use google chrome frame for IE8 and below with

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

Also see http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx and http://456bereastreet.com/archive/201103/x-ua-compatible_and_html5

Edit: as pocesar said in the comments your doctype is set incorrectly also, it should be

<!doctype html>

My site's document mode is changed to "IE5" automatically by IE11. I was able to solve it dong the following, I hope this is useful to somebody.

I can't explain why, but if I place the meta tag <meta http-equiv="X-UA-Compatible" content="IE=edge" /> after the <meta name="viewport" content="width=device-width, initial-scale=1"> , nothing happens, IE11 renders my site as IE5.

BUT, If i place the <meta http-equiv="X-UA-Compatible" content="IE=edge" /> before the <meta name="viewport" content="width=device-width, initial-scale=1"> , it works, my site's document mode is the latest one.

your doctype should be

<!doctype html>

and not <!-- DOCTYPE html --> , that defeats the use of the UA-Compatible tag

plus, you should place the meta tag as

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

or inside your .htaccess

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

(these are from HTML5 Boilerplate http://html5boilerplate.com/ )

console.log is the issue. Apparently IE just doesn't like it an the scrips will die. Remove all references to console.log and all is well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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