OptimizedWebfontLoading icon indicating copy to clipboard operation
OptimizedWebfontLoading copied to clipboard

Update to proper MIME type

Open theMikeD opened this issue 10 years ago • 2 comments

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.

theMikeD avatar Dec 22 '14 00:12 theMikeD

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.

bdadam avatar Dec 28 '14 23:12 bdadam

I think you're right. It turns out that I had changed it in both locations (js and css) and the warnings went away.

theMikeD avatar Dec 28 '14 23:12 theMikeD