-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preload: special-case font loading as anonymous-cors? #7627
Comments
This seems very strange and pretty undesirable. However I worry that browsers who try to change this will cause big perf regressions, if websites are just not using the How exactly does this work? In particular I don't understand how preloading images would work with this setup. What do the |
Both images and links have a Maybe the "clever" thing would be that the default for fonts is |
OK so it's something like this? <!-- mode: no-cors; credentials mode: include -->
<link rel="preload" as="image" href="img1.png">
<!-- mode: no-cors; credentials mode: include. MATCH -->
<img src="img1.png">
<!-- mode: cors; credentials mode: same-origin -->
<link rel="preload" as="image" href="img1.png" crossorigin="anonymous">
<!-- mode: no-cors; credentials mode: include. NO MATCH -->
<img src="img1.png">
<!-- mode: cors; credentials mode: same-origin -->
<link rel="preload" as="font" href="font.woff2">
<!-- mode: cors; credentials mode: same-origin. MATCH -->
<style>
@font-face {
family: x;
src: url("font.woff2") format("woff2");
}
</style>
<!-- mode: cors; credentials mode: same-origin (crossorigin="" ignored) -->
<link rel="preload" as="font" crossorigin="use-credentials" href="font2.woff2">
<!-- mode: cors; credentials mode: same-origin. MATCH -->
<style>
@font-face {
family: y;
src: url("font2.woff2") format("woff2");
}
</style> |
Actually maybe I misunderstand the new WPT, it's a bit difficult to read, and it does the right thing. Sorry for the noise. |
That is a bit strange, hmm. All browsers do that? Is that how font-face works, or just preload? |
I need to spend some cycles getting to the bottom of this. The WPT does seem strange. |
Hi, I am the author of the WPT.
Fonts are not special-cased in if Sorry if the WPT is confusing. Maybe the comment in the WPT test should be more clarified. |
Ah got it, thanks for the clarification. |
I have overlooked that test. I haven't read through the test in details yet but
|
Recently a new WPT was upstreamed from chromium, that shows that fonts are special-cased in
<link rel=preload>
, where theircrossorigin
attribute is ignored and always usesanonymous
as that's the default way fonts are preloaded.This seems to be the current behavior in Firefox and Chrome but is not specified (the current spec doesn't special-case fonts).
Is this the desired behavior? It's possible that we would want to allow loading fonts with credentials in the future as per this request and the URL modifiers proposal in CSS, which would make the current behavior of ignoring
crossorigin
counterintuitive?The text was updated successfully, but these errors were encountered: