Thursday, June 12, 2008

Supporting IE 8

Bill Gates announced during his Tech Ed keynote in Orlando last week that IE 8 Beta 2 would be released this August. You may already be aware that Microsoft has decided to release the final version of IE 8 with standards-compliant mode enabled, which will break many sites that assume that Internet Explorer is not a standards compliant browser.

To make it easy for sites to support IE 8 while retaining backward compatibility, Microsoft is introducing a few compatibility features.

A meta tag that will enable IE 7 mode on a per page basis (note that this is already available in Beta 1). This meta tag must be placed within a page's <HEAD> tags, thusly:

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

Other browsers will of course ignore this tag.

If you want to enable IE 7 layout for an entire site, you can add a custom header (this will be available in Beta 2 this August):

X-UA-Compatible: IE=EmulateIE7

When IE 8 detects either the site header or the meta tag, it will then look at each document's DOCTYPE to determine whether to render the page in IE 7 Quirks or IE 7 Standards mode.

One migration strategy would be to add the site-wide EmulateIE7 header, and add the meta tag with content="IE8" to pages as they are modified to support IE 8's standards-compliant layout mode.

For more information on adding custom headers on various versions of IIS and Apache, notes about detecting different browser versions, and more, I refer you to the Internet Explorer blog on MSDN.

 

Technorati Tags: ,