What mime type should WOFF fonts be served as?
I am serving truetype (ttf) fonts as font/truetype
and opentype (otf) as font/opentype
, but I cannot find the correct format for WOFF fonts.
I have tried font/woff
, font/webopen
, and font/webopentype
, but Chrome still complains:
"Resource interpreted as font but transferred with MIME type application/octet-stream."
Anybody know?
How do I install WOFF fonts? Installing WOFF fonts on your computer is easier than you might think. There are several websites out there to download fonts, so for example, visit FontSpace, then download a font. Unpack the zip file, then right-click on the font file and select Open With > Windows Font Viewer.
A WOFF file is simply a repackaged version of a sfnt font with optional compression of the font data tables. The WOFF file format also allows font metadata and private-use data to be included separately from the font data.
Update from Keith Shaw's comment on Jun 22, 2017:
As of February 2017, RFC8081 is the proposed standard. It defines a top-level media type for fonts, therefore the standard media type for WOFF and WOFF2 are as follows:
font/woff
font/woff2
In January 2011 it was announced that in the meantime Chromium will recognize
application/x-font-woff
as the mime-type for WOFF. I know this change is now in Chrome beta and if not in stable yet, it shouldn't be too far away.
For me, the next has beeen working in an .htaccess file.
AddType font/ttf .ttf
AddType font/eot .eot
AddType font/otf .otf
AddType font/woff .woff
AddType font/woff2 .woff2
It will be application/font-woff
.
see http://www.w3.org/TR/WOFF/#appendix-b (W3C Candidate Recommendation 04 August 2011)
and http://www.w3.org/2002/06/registering-mediatype.html
From Mozilla css font-face notes
In Gecko, web fonts are subject to the same domain restriction (font files must be on the same domain as the page using them), unless HTTP access controls are used to relax this restriction. 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: https://developer.mozilla.org/en/CSS/@font-face#Notes
Reference for adding font mime types to .NET/IIS
via web.config
<system.webServer>
<staticContent>
<!-- remove first in case they are defined in IIS already, which would cause a runtime error -->
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff" mimeType="font/woff" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
</staticContent>
</system.webServer>
via IIS Manager
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With