Wednesday, October 8, 2008

Firefox and stylesheet link mime-type

I found out that Firefox is a bit more strict than Internet Explorer when it comes to stylesheet links. I had one of the stylesheet files up on googlecode, in the downloads/files section. I'm hosting the blog completely on free servers, so I had to find a place to put the Syntax Highlighter stuff. For a while now I saw that the code on the blog was not shown correctly in Firefox, although it did show correctly in IE and thought 'pfff'. Until someone nagged me about it (thanks Marc).

Seams I had an error on my page, Firefox didn't like the mime-type of the file that was hosted on googlecode downloads. Reported that the mime-type was ‘text/x-c’, not ‘text/css’. Must be the default mime-type that is used to serve files from googlecode.

As far as I know, you can't control the mime-type for files in the googlecode downloads section. The solution is quite simple though, I moved the css file to the source section (svn) and added an 'svn:mime-type' property to the file. I used tortoisesvn for it, right click on the file, properties, add property with name 'svn:mime-type' and value 'text/css', commit. That way the file is served with the correct mime-type.