Wednesday, August 12, 2009

IIncorrect MIME Type for CSS Files

今日deploy 左一堆file 上server,點知啲page 係IE 上面show 係正常,FF, Chrome, Safari 等其他browser 就讀唔到個 css file。

Firebug 出左呢一句:
The resource from this URL is not text: ................/xxx.css

搵左一輪都未知乜野事,跟住諗下會唔會同Server 有關,係Fiddler 發現佢用Sun one web server,然後就用sun one web server load css 係Google search,跟住發現好有可能同CSS MIME Type 有關:

http://forums.sun.com/thread.jspa?threadID=5011423

其中一個reply:
The problem is very likely with the CSS MIME type.

Take a look at the archives for this newgroup for solutions and workarounds.

Fiddler check 到個 Content-type: application/x-pointplus。

然後用css mime type x-pointplus 再搵,第一個search result 就係Firefox official doc:
https://developer.mozilla.org/en/Incorrect_MIME_Type_for_CSS_Files

https://developer.mozilla.org/en/Properly_Configuring_Server_MIME_Types

P.S.:原來係 Web Developer Plugin 寫住:
Error: The stylesheet http://stage.acuvue.com.hk/include/css/acuvue.css was not loaded because its MIME type, "application/x-pointplus", is not "text/css".

No comments: