IE8 standards mode meta tag
Solution 1
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
Solution 2
Two possibilities:
The
meta
tag definitely belongs into the<head>
section of the document.If this is in an Intranet, this may be IE's "Smart default" kicking in. Yes, there is such a thing as smart defaults. See here. Because if you're in an Intranet, IE8 will automatically go into IE7 compatibility mode so as not to break the many corporate apps that rely on IE7. Makes sense, right? Right?
davidsleeps
Love web development and living on the surf coast in Victoria, Australia!
Updated on July 17, 2022Comments
-
davidsleeps almost 2 years
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>
-
davidsleeps about 13 yearsI think you're spot on...you can see how it could be interpreted as making sense. I was just hoping there was a way to force it into the correct standards mode in a more correct way. I haven't tried the host header yet though, maybe that's an option.
-
Pekka about 13 years@david yeah. Try the host header but before that, the meta tag in the right location, one of those might help.
-
davidsleeps about 13 yearsSorry, i'll clarify my question text, but I did try the correct placed meta tag but that it didn't work.
-
thirtydot about 13 years+1 for "smart default", it does sound like that is related. See a recent answer of mine for more details.
-
davidsleeps about 13 yearsThanks @thirtydot, your answer to the other question was quite helpful