Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

font-face with wrong MIME type in Chrome

This is the @font-face declaration I have used:

@font-face {     font-family: SolaimanLipi;     src: url("font/SolaimanLipi_20-04-07.ttf"); } 

This is working perfectly in Firefox but not in Chrome. After "inspect element" I got the following message:

Resource interpreted as font but transferred with MIME type application/octet-stream.

Any suggestions will be appreciated.

like image 891
moonstruck Avatar asked Oct 29 '10 12:10

moonstruck


People also ask

Do OTF fonts work on Chrome?

TTF/OTF - TrueType and OpenType font support is Fully Supported on Google Chrome 71.

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.

How do I use Google fonts in Font face?

go to google.com/fonts select all fonts that you will use by adding them to your collection, then click "use" - scroll down.


2 Answers

As usual, different browsers have different needs. Here is a cross browser @fontface declaration, taken from the Paul Irish blog -

@font-face {   font-family: 'Graublau Web';   src: url('GraublauWeb.eot');   src: local('☺'),          url('GraublauWeb.woff') format('woff'), url('GraublauWeb.ttf') format('truetype'); } 

.eot is for IE, the rest of the browsers use either .woff or .ttf If you need to generate the different types from the source font, you can use Font Squirrel's font-face generator

You also need to an .htaccess to the location of the fonts adding the following types:

AddType application/vnd.ms-fontobject .eot AddType font/ttf .ttf AddType font/otf .otf AddType application/x-font-woff .woff 
like image 182
Eran Galperin Avatar answered Sep 21 '22 23:09

Eran Galperin


You can ignore the warning and may want to consider this post on the topic, Proper MIME type for fonts

Which also mentions the following:

"Note: Because there are no defined MIME types for TrueType, OpenType, and WOFF fonts, the MIME type of the file specified is not considered."

source: http://developer.mozilla.org/en/css/@font-face

like image 45
Domokun Avatar answered Sep 17 '22 23:09

Domokun