Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google warning: Resource interpreted as Font but transferred with MIME type application/octet-stream

Tags:

css

font-face

I have a warning in Google for my font-face:

Resource interpreted as Font but transferred with MIME type application/octet-stream: ".../Content/Fonts/iconFont.ttf".

It works even if I have this warning but I prefer avoid this warning.

Here is my declaration:

@font-face {   font-family: 'iconFont';      src: url('../Fonts/iconFont.eot?#iefix') format('embedded-opentype'),       url('../Fonts/iconFont.svg#iconFont') format('image/svg+xml'),       url('../Fonts/iconFont.woff') format('font/x-woff'),       url('../Fonts/iconFont.ttf') format('truetype');   font-weight: normal;   font-style: normal; } 

I already search on other posts but no luck so far.

Please note that my server is IIS from Microsoft.

Any idea how can I avoid this warning?

Thanks.

like image 280
Bronzato Avatar asked Mar 20 '13 10:03

Bronzato


People also ask

What is MIME type application octet stream?

The application/octet-stream MIME type is used for unknown binary files. It preserves the file contents, but requires the receiver to determine file type, for example, from the filename extension. The Internet media type for an arbitrary byte stream is application/octet-stream .

What MIME type is TTF?

TTF font files has the following MIME type: font/ttf . Before February 2017: TTF does not have a MIME type assigned. You'll have to use the more general application/octet-stream , which is used to indicate binary data with no assigned MIME type.


2 Answers

You need to add the following types to an .htaccess/IIS:

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

Updated .woff type from:

AddType application/x-font-woff .woff 

(Thanks to @renadeen in comments below for pointing this out.)

Check out my answer to a similar question here: Font Face not loaded

Taken from here: font-face problem in chrome.

like image 177
97ldave Avatar answered Oct 12 '22 13:10

97ldave


Thanks for the above answer @97ldave, you can add these types to your IIS webServer configuration section if you'd rather not add them directly to your MIME types in your IIS setup. The following shows an example of adding just the .woff type that was missing from our configuration. This fixed the issues with the fonts not appearing in the latest version of Safari (6.0.3) on my iMac.

<system.webServer> <staticContent>   <remove fileExtension=".woff" />   <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> </staticContent> </system.webServer> 

Thanks to Jon Samwell (my colleague) for finding this out.

like image 28
The Senator Avatar answered Oct 12 '22 12:10

The Senator