2 ms·
A good way for Google to address this would be by enabling CORS and encouraging the use of crossorigin=anonymous to avoid credentials being sent for fonts: <li
by acdha 12y ago
A good way for Google to address this would be by enabling CORS and encouraging the use of crossorigin=anonymous to avoid credentials being sent for fonts:
<link href='http://fonts.googleapis.com/css?family=Open+Sans' http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' crossorigin='anonymous'>
Unfortunately, a quick test (http://chris.improbable.org/experiments/browser/webfonts/google-fonts-crossorigin.html http://chris.improbable.org/experiments/browser/webfonts/goo...) shows that this can't be done currently because fonts.google.com doesn't have an Access-Control-Allow-Origin header:
https://redbot.org/?uri=http%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DDancing%2BScript https://redbot.org/?uri=http%3A%2F%2Ffonts.googleapis.com%2F...
(Oddly, the actual fonts are served with "Access-Control-Allow-Origin: *" so it works if you self-host the CSS, which would presumably be a bad idea: https://redbot.org/?uri=http%3A%2F%2Ffonts.gstatic.com%2Fs%2Fdancingscript%2Fv6%2FDK0eTGXiZjN6yA8zAEyM2S5FJMZltoAAwO2fP7iHu2o.ttf https://redbot.org/?uri=http%3A%2F%2Ffonts.gstatic.com%2Fs%2...)
This is the behaviour defined in the HTML5 spec:
https://html.spec.whatwg.org/multipage/infrastructure.html#cors-settings-attribute https://html.spec.whatwg.org/multipage/infrastructure.html#c...
In some ways, this feels like an oversight in the spec because crossorigin=anonymous is actually better than the legacy behaviour but any use of the crossorigin attribute triggers mandatory full CORS checks.
- LeoNatan25 12y agoGoogle has little to gain from these.
- acdha 12y agoGoogle has an interesting position advocating for improved privacy and security. This would be a cheap way for them to back that up at relatively minimal expense.