谷歌浏览器提供警告资源解释为字体,但与MIME类型application / octet-stream传输: [英] Google Chrome gives warning Resource interpreted as Font but transferred with MIME type application/octet-stream:

查看:4227
本文介绍了谷歌浏览器提供警告资源解释为字体,但与MIME类型application / octet-stream传输:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断收到此警告



资源解释为Font,但使用MIME类型application / octet-stream传输:http://127.0.0.1:8080/assets /font/fontawesome-webfont.woff。

我正在使用Play 2.0.4网络服务器。我添加了mime-types到我的application.conf文件中,如下所示:

  mimetype.eot = application / vnd.ms-fontobject 
mimetype.otf = application / octet-stream
mimetype.ttf = application / x-font-ttf
mimetype.woff = application / x-font-woff

$ b

任何想法我可能做错了。

解决方案

其实,我找到了答案:


有些浏览器,如Google Chrome,会在字体
是从Web服务器下载的,它为
字体设置了意想不到的MIME类型。



对于许多字体类型,有一个解决方案!



使用以下MIME
类型为每个字体文件扩展名更新Web服务器的配置:

  .ttf  -  font / truetype 
.otf - font / opentype
.eot - application / vnd.ms-fontobject
.woff - application / x-font-woff

如果您的
正在使用Apache配置,您可以为每种字体类型添加AddType指令



AddType应用程序/vnd.ms-fontobject eot

AddType字体/ truetype ttf

AddType应用程序/ x-font-woff woff

AddType字体/ opentype otf



对于每种字体配置的特定MIME类型,而不是通用的
application / octet-stream MIME类型,您不应该在您的应用程序中看到警告
这个配置虽然对清理控制台有效 -
不包含技术上正确的MIME类型,例如OTF,
TTF和WOFF。对于这些字体类型,官方MIME类型尚未批准
(尚)。 WOFF的官方类型 - application / font-woff
- 已被要求.AddType字体/ opentype otf


http://www.jbarker.com/blog/2011/资源解释字体转换MIME类型


I keep getting this warning

Resource interpreted as Font but transferred with MIME type application/octet-stream: "http://127.0.0.1:8080/assets/font/fontawesome-webfont.woff".

I am using Play 2.0.4 webserver. I added the mime-types to my application.conf file as follows

mimetype.eot = application/vnd.ms-fontobject
mimetype.otf = application/octet-stream
mimetype.ttf=application/x-font-ttf
mimetype.woff = application/x-font-woff

Any idea what I may be doing wrong.

解决方案

Actually, I found the answer:

Some browsers, like Google Chrome, will show this warning when a font is downloaded from a web server that sets an unexpected MIME type for fonts.

For many font types, there is a solution!

Update the configuration for your web server with the following MIME type per font file extension:

.ttf — font/truetype 
.otf — font/opentype 
.eot — application/vnd.ms-fontobject 
.woff — application/x-font-woff 

If you are using Apache configuration, you may include the AddType directive for each font type:

AddType application/vnd.ms-fontobject eot
AddType font/truetype ttf
AddType application/x-font-woff woff
AddType font/opentype otf

With a specific MIME type configured per font, and not the generic application/octet-stream MIME type, you should no longer see a warning in your web browser console.

This configuration — while effective for cleaning up your console — does not include the technically correct MIME type for fonts like OTF, TTF, and WOFF. For these font types, an official MIME type has not (yet) been approved. An official type for WOFF — application/font-woff — has been requested.AddType font/opentype otf

http://www.jbarker.com/blog/2011/resource-interpreted-font-transferred-mime-type

这篇关于谷歌浏览器提供警告资源解释为字体,但与MIME类型application / octet-stream传输:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆