Tuesday, January 22, 2008

Preparing for IE8, Version-targeting

That's right. There is another version of IE on the horizon and it promises to pack to some big changes for developers. But unlike the headaches suffered during the introduction of IE7, IE8 is introducing some radical new concepts that could forever change the way we develop for the web.

But first things first. What's going to be so different in IE? For starters, it is going to pack a brand new HTML rendering engine. The engine was written from scratch with the chief goal of delivering a browser that implemented the most important CSS 2.1 standards as correctly as possible. The IE Team demonstrated the early fruit of their labor a few weeks ago by announcing that the current builds of IE8 can successfully pass the Acid2 standards test. According to the IE Team, the new browser engine is going to deliver "great styling and layout changes," but right now all we know is that it's well on its way to meeting standards already observed by browsers like Safari, Opera, and (soon) Firefox 3.

All of this improvement on the standards front, though, has the potential to create chaos similar to the IE6 to IE7 transition, right? Not if the IE Team has their way. Recognizing the problems IE7 caused for many developers and wanting to find a way to safely introduce new rendering capabilities in the future, Microsoft has introduced a new mechanism that will enable developers to target specific versions of IE in the future.

The new version-targeting feature will enable developers to tell browsers which version of the browser the page has been built and tested for. Implemented as a new meta tag, developer's must simply include the following line near the top of their page's head section to "opt-in" to a new browser version:

<meta equiv="X-UA-Compatible" content="IE=8" />
When this meta tag is present, the browser will render the page in the version "mode" supplied. When it's not present, in the case of IE at least, pages will continue to be rendered in IE7 mode. That means all of the pages you have today that work in IE7 should look exactly the same in IE8 by default. You must "opt-in" for the new stricter standards mode.

This mechanism has been developed with other browsers in mind, so ideally all major browsers will support this version targeting in the future. If that becomes the case, there could be a future where you don't have to worry about new versions of IE or Firefox breaking your page rendering. Your sites will only render differently in new browser versions when you tell them to.

While this is an interesting change in the browser space, the approach is not without its problems. Noted standards advocate Eric Meyer has a full discussion on the potential problems and advantages of this development in a blog post on A List Apart. Meanwhile, also on A List Apart, Aaron Gustafson from the Web Standards Project and member of the Microsoft Task Force addressing this issue of backwards compatibility has a post detailing the process that lead to the creation of this new meta tag. It is a great read for more background on why and how version-targeting should work.

The takeaway: IE8 is on the way and it is going to be the most standards compliant IE to date...if you tell it to be. If you do nothing, IE8 shouldn't (and this has yet to be proven) render your pages any differently that IE7. Watch for more IE8 details around the time of Mix.


Chris Catto said...

I like the post, nice summary from the IE blog.