[whatwg] First or last Content-Type header?

On Tue, Jun 2, 2009 at 12:19 AM, Julian Reschke <julian.reschke at gmx.de> wrote:
> Adam Barth wrote:
>> In any case, the four major browsers that actually look at the
>> Content-Type header agree and use the last header. ?The only browser
>> that uses the first header more or less ignores it anyway.
>
> Could you clarify that last point?
>
> Are you talking about IE? Which version?

Sure.  For the sake of discussion, let's say IE6 and IE7.  Basically,
if the Content-Type header contains a value IE knows about, then IE
pretty much ignores the value and engages its sniffing algorithm.  So,
for example, if a response has:

Content-Type: text/html
Content-Type: image/gif

and is really a GIF.  IE will show the image correctly because it will
see the text/html type, ignore it, and then sniff GIF from the
content.  By contrast, Firefox and Chrome will see the type image/gif
type and show the image correctly.  This is quite likely to occur on
the web because it works in every browser.

Now, consider the reverse:

Content-Type: image/gif
Content-Type: text/html

In this case, IE renders the image correctly, but Firefox and Chrome
don't show the image.  This is less likely to occur on the web because
it doesn't work in Firefox (e.g., >20% of the market).

Adam

Received on Tuesday, 2 June 2009 01:17:14 UTC