IE8 standards mode meta tag

davidsleeps picture davidsleeps · Feb 13, 2011 · Viewed 29.6k times · Source

A web application we have for an organisation that is officially upgrading its standard browser from IE6 to IE8 (queue celebrations), we've set all our DOCTYPEs to be <!DOCTYPE html> (as well as fixed other html code) and I thought that in IE8 this would cause the page to be rendered in IE8 Standards Mode. However, it is still shown in IE7 Standards mode.

I've added the <meta http-equiv="X-UA-Compatible" content="IE=8"> into the <head> section and it still fails to default to IE8 Standards mode. I'm presuming at this stage that there must be a setting (perhaps Group Policy etc) that is forcing the mode.

After reading a hack on an MSDN forum that if you put the meta tag before the <html> tag, it correctly displays as IE8 Standards mode, and this worked for me. Is there another way to do this? It just looks terrible seeing the meta tag there...

Here's roughly how each page is made up:

<!DOCTYPE html>

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

<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Page Title</title>
</head>
<body>
</body>
</html>

Answer

thirtydot picture thirtydot · Feb 14, 2011

You could set X-UA-Compatible as a HTTP response header, instead of as a meta tag.

This is a much cleaner solution than placing it above the <html> tag.

A confusing useful blog post concerning X-UA-Compatible and its many intricacies:

http://farukat.es/journal/2009/05/245-ie8-and-the-x-ua-compatible-situation