I'm using the HTML5 doctype with X-UA-Compatible meta tag near the top:
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en-us" class="ie6"> <![endif]-->
<!--[if IE 7]> <html lang="en-us" class="ie7"> <![endif]-->
<!--[if IE 8]> <html lang="en-us" class="ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en-us"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
...
But Internet Explorer 9 for some users is rendering the page in compatibility view. I suspect it's because they have the "Display all websites in Compatibility View" setting turned on. Is there a way to force IE9 to use IE9 Browser and Document Mode?
It turns out that the solution is to set X-UA-Compatible in the HTTP header and not in the HTML:
This will force Internet Explorer to use the latest rendering engine, even if "Display all websites in Compatibility View" is turned on.
@netzaffin is right - if X-UA-Compatible is the first meta tag in HEAD section, IE9 works.
It's also working with this in
<head>
in html:The X-UA-COMPATIBLE meta tag has to be the first tag inside the head, or else it will not work. See this answer: https://stackoverflow.com/a/22233206/3329906.
All this http header stuff is overkill.
Only adding
will do ;)
For eg:
please append in head section of your website, hope it helps.