Dorward's Ramblings


Published on

For a long time, Internet Explorer has engaged in content sniffing, which can override Content-Type specified by the server.

This is wrong.

If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource.

HTTP 1.1, section 7.2.1

This practise has had a number of side effects, one of which has been a number of encounters with websites (all, coincidentally, using ASP) serving up their web pages as text/plain and not noticing that users of every browser other then Internet Explorer were seeing source code instead of rendered documents. On the flip side, attempts to serve up examples of HTML source code as text documents resulted in Internet Explorer attempting to render them.

Microsoft have a solution! Authors can say “authoritative=true” in the Content-Type header, and Internet Explorer will then respect the header.

Hang on. Haven’t we heard this before?

Before version 6, Internet Explorer had vast numbers of rendering bugs. Version 6 had many bugs, and sniffed the Doctype to guess if the author knew what they were doing, and enable some of those bugs if the conclusion was “no”. Version 7 had lots of bugs, and did the same thing - sites, unfortunately, broke.

For version 8, Microsoft came up with another solution: Pretend to be IE7 unless the author explicitly says otherwise.

The Blogosphere exploded with cries of “No, I shouldn’t have to say ‘follow the standard’, that should be the default”.

Microsoft backed down.

There hasn’t been a repeat explosion yet, but perhaps it is time. Come on Microsoft: Implement the specification!.