Using the IE8 X-UA Compatibility Meta Tag Properly

HTML5, CSS3 and JavaScript

The Fine Art of Web Development by Martin Ivanov

Internet Explorer 8 is out, with a couple of rendering modes, that will take time to handle. As you know, IE8 renders pages in standards compliance mode by default, and the X-UA compatibility tag has been a good idea of Microsoft, as it gives a chance to developers who have not optimized their websites for IE8 to put things to work with less effort.

Did you try it already? If it is something new to you, it works like that:

1. Add the following meta-tag in the head section of your webpage above any linked files (i.e, above <link>…</link> and <script>…</script> tags)

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

If the tag is below link or script tags, the fix will not work.

2. Reload the page, and the meta tag will force IE8 to use the rendering engine of IE7, and your webpages will look as they did before, until you find a solution for the issues you have noticed when IE8 was released.

If your pages behave as expected under IE8 then you should use the IE8 meta tag.  This will ensure that your code will continue to run properly after the next browser upgrade:

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

In summary, the compatibility UA-X meta tag is a good and legal trick to be comfort with your visitors.

Do not hesitate using it.

More Cool Stuff

Categories and Tags

© 2006 - 2023 Martin Ivanov