mime types

While debugging some Javascript code in Mozilla’s handy Javascript console, I got this error whenever I loaded a page from my site.

Warning: The stylesheet https://dan.hersam.com/css/white.css was loaded as CSS even though its MIME type, “text/plain”, is not “text/css”.

Some research revealed that apache uses a mime.types file which defines all of the types it knows about. If the type isn’t defined, it uses the DefaultType directive which is usually set to text/plain. To get rid of the error I simply had to add the following line.

text/css css

You can also add the following line to httpd.conf or your .htaccess file

AddType text/css css

It’s strange that the browser didn’t pay attention to the <link> tag in my page, which includes the type.

<link href=”https://dan.hersam.com/css/stylesheet.css” rel=”stylesheet” type=”text/css”>

Comments

 (Post a comment) | Comments RSS feed
  1. I will keep this in mind.There is no telling,one day it just might come in handy ! Thanks Dan :D

    Comment by Tammie on March 4, 2003 @ 5:47 am

Comments are closed