OptimizedWebfontLoading
OptimizedWebfontLoading copied to clipboard
Update to proper MIME type
Great code, playing with it now in WordPress. After setting it up I noticed error like the following in the Chrome dev tools console
Resource interpreted as Font but transferred with MIME type application/x-font-woff2
Looking through the JS I noticed this
var localStoragePrefix = 'x-font-' + fontName;
Isn't the official MIME type for this without the x- part? Changing this made the errors go away.
I think the actual problem is in the demo css files. They declare the @font-face with the wrong mime type. https://github.com/bdadam/OptimizedWebfontLoading/blob/master/build/fonts.woff2.css
I'll take a deeper look in a few days. Thanks for pointing out this problem.
I think you're right. It turns out that I had changed it in both locations (js and css) and the warnings went away.