Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I force Internet Explorer to render in Standards Mode and NOT in Quirks?

I am coding a Frontend which works well in IE7 Standards Mode and IE8 Standards Mode.

When I start up Internet Explorer and load the page both IE7 and IE8 go to Quirks Mode directly. How can I force both IE7 and IE8 to always load the page in Standards Mode?

I have no special meta tags added so far.

Thanks for helping me out

Edit: My doctype and head looks as follows at the moment:

<!DOCTYPE html>  <html lang="de">  <head>      <title>...</title>      <meta http-equiv="X-UA-Compatible" content="IE=edge" />     <meta charset="utf-8" />     <script src="js/html5.js"></script>       (...) </head> 
like image 267
maze Avatar asked Mar 21 '11 05:03

maze


People also ask

What's the difference between standards mode and quirks mode?

In quirks mode, layout emulates nonstandard behavior in Navigator 4 and Internet Explorer 5. This is essential in order to support websites that were built before the widespread adoption of web standards. In full standards mode, the behavior is (hopefully) the behavior described by the HTML and CSS specifications.

How do I know if Internet Explorer is in quirks mode?

In IE you will see it in the developer tools (pressing F12), it says it in the menu: Document Mode:... And you can also force a different mode there.


1 Answers

This is the way to be absolutely certain :

<!doctype html> <!-- html5 --> <html lang="en"> <!-- lang="xx" is allowed, but NO xmlns="http://www.w3.org/1999/xhtml", lang:xml="", and so on --> <head> <meta http-equiv="x-ua-compatible" content="IE=Edge"/>  <!-- as the **very** first line just after head--> .. </head> 

Reason :
Whenever IE meets anything that conflicts, it turns back to "IE 7 standards mode", ignoring the x-ua-compatible.

(I know this is an answer to a very old question, but I have struggled with this myself, and above scheme is the correct answer. It works all the way, everytime)

like image 55
davidkonrad Avatar answered Oct 31 '22 17:10

davidkonrad