The Daily T -

X-UA-Compatible is good, sort of

I never thought I’d be singing the praises of the insane X-UA-Compatible header of IE 8 – application version targeting on the web seems like an idea incredibly counter to web standards whichever way I look at it.

Today though, I found a use for it: Testing in various versions of IE. I have Multiple IE installed and regularily open 6 and 7 – and now 8 – to test styles and scripts. I noticed today that the IE 8 had apparently killed IE 6, input elements weren’t working anymore. So I got the idea of using the X-UA-Compatible header, like so:

I’m not sure why I was surprised that it worked, but I was – and it did. It renders a page I was having problems with exactly like the proper IE 6 does.

I can’t find anywhere which versions are accepted, but 6 and 7 seems to render exactly like the proper versions so far, with the notable difference of png transparencies actually working when using “IE=6″, as opposed to in the real browser.

So, for now Multiple IE is replaced with a simple meta tag for me. I remain a little suspicious: the toolbar button included in IE 8 to change to IE 7 mode requires a restart of the browser while this meta tag is picked up on only a page refresh; what else is being done in that restart? One thing that changes is the User Agent string, it is being reported as IE8 until the 7 compatibility restart is done, regardless of the meta version target setting. After the restart it reports IE7. MooTools reports trident5 (IE7) regardless, which likely means the change is just cosmetic – the javascript engine running is still IE8′s.

This is not to say I like version targeting at all still, but I’m happy Microsoft has helped a little to make tests in different browser versions easier. At least as far as style is concerned. X-UA-Compatible is good, sort of