boakes.org

IE and PNG’s

How can I tell my Apache server that MSIE prefers JPEG files over PNG?

The images you see associated with each story on this website are available in two formats. The first (and preferred) format is PNG. The second format is JPEG. JPEG is still good, but doesn’t include alpha transparency information.

Content Negotiation

The two formats are used so that browsers which cannot display PNG’s are instead sent JPEG’s automatically. This works because of an Apache feature called content negotiation. The idea of content negotiation is that it enables the client to tell the server what kinds of file it can use.

The assumption of this technique is that the client knows what it can and cannot display, and that the client is correct when it gives this information to the server.

In the case of Internet Explorer version 6, this is not the case. IE6 cannot display PNG’s properly.

What I want to be able to do is to have the Apache server refuse to send PNG’s to IE as part of it’s content negotiation, thus leaving JPEG’s as the only option. Such behavior, however, has eluded me; so please speak up if you know how to achieve it.

It’s also worth mentioning that although it could quite easily be done in PHP, it would mean that the pages could no longer be cached, so this is not solution.

Alternatives

If you’re viewing this site using IE6, it probably looks bad, sorry; IE6 sucks and there’s only so much time I’m able to commit to cleaning up Microsoft’s mess.

IE7 is on the way but in the mean time you might like to try an alternative. Personally I use Firefox but Opera is also very good. Both are capable of rendering content properly.