Henrik speaking at a conference

Hi, I’m Henrik Joreteg

Mobile web consultant, developer, and speaker

posts | twitter | email | hire | book | my startup: Xchart.com

Forcing HTML5 support in IE8!


UPDATE: this plugin works for IE6, IE7 and IE8, not just IE8 as this article suggests

Every web-developer knows how hard IE sux. IE8 is at least somewhat standards compliant, but I’d be willing to bet that they’re going to drag their feet in implementing all the HTML5 awesomeness that makes the web even more promising than it already is.

It’s not a perfect solution, but the boys at Google wrote an IE8 plugin called Chrome Frame that uses Chrome’s rendering engine (Webkit) to render certain pages. As a dev you can sniff for it and prompt them to install it if it’s not there. Here’s the magic:

<meta http-equiv="X-UA-Compatible" content="chrome=1"/>

Adding this meta tag will tell IE8 to render the page with Chrome Frame if the plugin is installed.

However, since most IE8 users won’t have it installed, (at least at this point) simply adding that tag won’t help you too much. So you need to sniff for it and you can prompt the user to install the plugin if it’s not present:

<body>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/chromeframe/1/CFInstall.min.js">
</script>

<div id="placeholder"></div>

<script>
    CFInstall.check({
        node: "placeholder",
        destination: "http://www.waikiki.com"
    });
</script>
</body>

You can modify how to prompt the user by changing the configuration, just refer to the developer documentation. I for one am quite excited about this because it’s a way to circumvent Microsoft’s slowness in adopting HTML5 and users will simply be prompted to install a plugin, which is an experience they’re already used to for flash sites, etc.

Obviously this doesn’t help us for IE 6 and 7 but odds are pretty good that when Windows 7 is released we’ll see a significant boost in IE8 usage. I, for one, plan on building a bunch of stuff that requires HTML5 support so any expansion in support for that in “Microsoft land” is exciting to me.

Also, here’s the announcement and the official explanation vid: