Dorward

Doctype Switch 2.0

23 January 2008

When I arrived at the office yesterday morning, the storm was just beginning to hit. Microsoft had announced what they were going to do to avoid "breaking the web". In short, authors have to explicitly opt in to standards mode or version 8 and upwards of Internet Explorer will switch to Internet Explorer 7 emulation mode.

Bugged Internet Explorer by Hashir Milhan

Last night, the blogosphere exploded with commentary on it, almost all negative. I, on the other hand, met some friends at the pub, so I'm lagging behind most of the rest of the web standards community on this subject, but I did get to drink a couple of pints of beer.

I'm not going to go into depth about what the problems are, since other people did a fantastic job at that while I was drinking.

I will comment on Peter-Paul Kock claiming that the versioning switch is not a browser detect. In particular, this section:

Therefore, if a non-IE browser encounters the switch, nothing happens. The browser ignores the >meta< tag, reads the HTML, CSS, and JavaScript as always, and allows its own rendering engine to interpret it.

<p>In other words, the versioning switch does not have any of the negative effects of a browser detect.</p>

Let us take a look a bit of history. When browser sniffing started publishers would serve up one set of code to a one browser, and a different set of code to another browser (that was considered to be unable to cope).

So Yama 1.1 gets some nice code, and Awooga 1.0 gets some nastier code. Then Awooga 1.5 is released, and it is much better, but it is still going to get the nasty code designed for the previous version. So what happens?

The browser vendor tells Awooga to pretend to be Yama, so it gets the code designed for Yama.

This went on for years, even to the extent the Safari, which is the youngest of the Big Four browsers was released with "like Gecko" in the user agent string. Happily almost nobody does browser sniffing based on the user agent these days (unless they are using ASP.NET … which is a Microsoft product, I'm detecting a theme here).

Now along comes this idea that authors will start claiming "I wrote this for IE8, but IE9 is better and will break this page, so pretend to be IE8". It is possible, hopefully not likely, but certainly possible, that other browsers will go "Well, if it is going to break in IE9 then might it not also break in Firefox 4? I'd better act like IE8 too."

So, despite the claims of some, this does have the risk of suffering the same problems that user agent sniffing does, just backwards. I hope it won't, but I'm not going to rule out the possibility.

Enough worrying about just how badly wrong this could go for the web. What am I going to do about it? There are a number of options.

  • Pander to their nutty idea and stuck the header in. Reconfiguring my server to do that would be trivial.
  • Pander slightly less and stick in the 'edge' header, which causes IE to follow what should be the default behaviour.
  • Ignore it and let IE act like version 7 until Microsoft see sense.
  • Slap an advert for an alternative browser in each page (behind a conditional comment), as I did for a while a couple of years ago.
  • Do as Mike and Shelly suggest and just follow the specs (although perhaps not using XHTML unless there are actual benefits to doing so) regardless of how browser support for them is.
  • Switch to Flash.

All the options have their attractions, and at this stage I really don't know what I'm going to do … aside from moan about Microsoft.

Bugged Internet Explorer by Hashir Milhan is used under a creative commons license.