Handle IE8: Use Chrome Frame If Available, Fallback To IE7 [Updated]

Internet Explorer 8 wasn’t a welcome surprise. While the new rendering engine was supposed to be more standards compliant, the CSS engine wasn’t updated similarly, so the net result was it couldn’t render advanced CSS layouts anyway, even if it tried to. The solution was to add a meta tag to tell IE8 to use the IE7 rendering engine; at least that meant you didn’t have to target two browsers.

Google Chrome Frame, on the other hand, was a welcome surprise. Chrome Frame brings Google Chromes superior rendering engine to IE. But it’s still a plugin so it has to be installed, and it has to be invoked using a meta tag.

Combining the two meta tags, so that we use Chrome Frame if available, but fall back to using IE7s rendering engine if not, we get this meta tag:

I’ve tested it on a recent site, and it works as advertised.

[Update]: Google has changed the way you invoke Chrome Frame. Please read more on this.