IE8 compatibility: make IE8 render as same as IE7

Previously, I mentioned Microsoft Internet Explorer 8 has been released, but there are certainly some compatibility issues for some website for IE8, especially javascript and html rendering.

If you don't have much time to cater this new browser, Mcrosoft provided a quick solution:

EmulateIE7 tag

There are two ways to implement this tag:

  • On a per-site basis, add a custom HTTP header
    X-UA-Compatible: IE=EmulateIE7
  • On a per-page basis, add a special HTML tag to each document, right after the <head> tag
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

Here is an small example for meta tag:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
            <!-- above line should be right after head tag -->
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <meta name="robots" content="index, follow" />
            <meta name="keywords" content="swiftcore, php, javascript, magento, drupal, joomla, development" />
            <title>website title here</title>
            <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
            <script type="text/javascript" src="/media/system/js/mootools.js"></script>
    </head>

    <body>
        ......
    </body>
</html>

You can try to download IE8 here.

And to be honest, IE8 is more faster than IE7 and even IE6, although someone says it is still the slowest, I bet you should try it.

Comments

Thank you very much

This saved my life.