I have the header in my HTML page like this below and I open this site in IE8. When I look at it in "Web Developer" the "if IE 7" is active. WebBrowser set BrowserMode on "IE8 Compact VIew" and "Document Mode" on "IE7 standards". I have javascript on the site, which doesn't work good with these settings. Why does it happen? Why IE variable is equal 7? Why Browser is in these mode?
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html lang="de" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="de" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="de" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="de" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="de" class="no-js"> <!--<![endif]-->
Others have recommended using
X-UA-Compatible IE=8
, but note that this will force IE to run in IE8 mode, even if the user has IE9 (or later). This is generally not what you're going to want.Better to specify that IE should use the latest rendering engine available to it. For that, you use the same
meta
tag, but useIE=edge
as the value, instead ofIE=8
.Note that IE has a configuration panel which allows you to specify when it will use compatibility mode. For some reason, the default for this is to use compatibility mode for "sites in the local intranet".
This is the most common reason for IE jumping into compatibility mode unexpectedly when you're developing a site, as your
localhost
server will be treated as being "in the local intranet".You can change this setting easily enough by going to the "Tools" menu, and picking the "Compatibility View Settings" option.