关于基于webkit浏览器下面.cur和.woff文件的MIME TYPE问题

Chrome console报warning信息:

Resource interpreted as Font but transferred with MIME type application/octet-stream …
Resource interpreted as Image but transferred with MIME type application/octet-stream …

在这两个地方找到答案:
Mime type for WOFF fonts?
Cursor Mime Media Type

对于WOFF fonts,目前来说可用的mime 类型是

1
application/x-font-woff

而对于 .cur和 .ico 文件来说,目前可用来避免警告信息的是

1
image/vnd.microsoft.icon

PHP:

1
2
3
4
#对woff font
header("Content-Type: application/x-font-woff");
#对.cur文件
header("Content-Type: image/vnd.microsoft.icon");

Apache
对于Apache ,可修改mime.types文件,加上:

1
2
application/x-font-woff woff
image/vnd.microsoft.icon cur

没有权限修改配置文件的话,可在目录下面放一 .htaccess文件,加上:

1
2
AddType application/x-font-woff .woff
AddType image/vnd.microsoft.icon .cur

Apache AddType指令参考文档:http://httpd.apache.org/docs/2.3/mod/mod_mime.html#AddType

更多
No Responses Post a comment

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS