ie

Quick IE7 and IE8 Browser Testing
The X-UA-Compatible header directs Internet Explorer to mimic the behavior of Internet Explorer 8 when determining how to display the webpage. Read more on defining document compatiability.
Plain Copy
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
So your page might look like this:

Plain Copy
<html>
<head>
  <!-- Enable IE8 Standards mode -->
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
  <title>My webpage</title>
</head>
<body>
  <p>Content goes here.</p>
</body>
</html>
IE Dev Tools
If we inspect IE dev tools we can see it’s running in IE8 Standards Document Mode (press F12 to open IE developer tools). From here we can easily switch between the versions but the version we specified in the meta tag becomes the page default.



Why use the meta tag?
You may be thinking why use the meta tag when you can just change the mode in IE dev tools. Well if you are using a conditional to load an IE8 stylesheet the meta tag forces this to be loaded.

Plain Copy
<!--[if IE 8 ]> <link rel="stylesheet" href="css/ie8.css" type="text/css"> <![endif]-->
IE7
And for IE7 the same thing just use the following meta tag.

Plain Copy
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
More thoughts
Note that I’m pretty sure this will only work when using IE9 (won’t work in FF or Chrome – correct me if i’m wrong there) and you’ll need to do a hard page refresh once you add the meta tag. Also I’m not sure about IE10, I’m yet to have used it!!!


Comments