-
Notifications
You must be signed in to change notification settings - Fork 31
Explain rel=preload in terms of Fetch #81
Comments
A little more context. From the fetch spec:
From the
Both specs refer to "priority", but there is no connection in the spec between these two concepts. |
There is a lot to be done to explain prioritization in the platform... We added a "vague note about priority to at least acknowledge it exists" and we haven't made much progress since. On a practical level, all UA's do apply some heuristics for relative prioritization of how resources are loaded: this varies based on lifecycle of the page, the protocol, and other conditions (e.g. type of network, etc). Which is to say, yes, it is hard to tell what it means in detail, and it's a medium~large undertaking that I'd love to see someone take on. Also, this is not specific to preload in any way, it applies to every fetch, and I think it's a discussion better had in the context of Fetch spec - e.g. how does destination type affect prioritization, what is prioritization, etc. Preload, specifically, sets the destination via
We can probably wordsmith that note to be a bit more clear about the intent, which is simply to point out the difference between prefetch and preload.. By "high priority" it's simply meant to highlight that the UA should not defer loading the resource, as it may do for prefetch.
Does that sound a bit better? My proposal here is that we (a) update the note and remove 'priority' to minimize confusion, and (b) start a new thread on Fetch repo to "explain prioritization". |
Well, the request here is to explain preload/prefetch. Even if Fetch explains prioritization, we'd still need updates here to make use of it. |
Prefetch is covered in Resource Hints. This spec is for Preload, so let's focus on that..
What else is missing? There is really nothing else to say, I think, for the prioritization bits in Preload. |
So |
As defined, yes. If you add "as=image" on preload, then it would be ~equivalent to |
What do you mean with "as defined"? It sounds like you're saying they are different. |
No, no.. "Equivalent" :) |
(I don't know if this issue is meant only to deal with request behaviour, or also with processing behaviour after receiving a response. Since @annevk mentioned possible emulation in Service Workers, I'm assuming the responsive processing is in scope of this issue as well. If not, I could create a separate issue for that.) While the way the request is made is equivalent to a plain Given an attempt to emulate preload by looking for the Link-preload headers in a Service Worker and making a |
Yeah, we need to define a "preload cache".
You could in fact implement a "preload cache" as part of your SW code. Some parts are missing in Fetch, I think, in order for you to do that. e.g. I don't think you can set the appropriate destination for |
@annevk - could you detail what is missing in your opinion for such "explaining in terms of Fetch"? One big item on my list is defining the preload cache, but it seems like something that should be defined inside Fetch. Do you agree? If so, I'll open an issue there specific to the preload cache. (I think the preload cache should be decoupled from whatwg/fetch#354 as it should operate at a totally separate layer) Anything else? |
@wycats mentioned that currently rel=preload is a mandatory high-priority fetch, but since it's not explained in terms of Fetch you can't emulate it in workers and it's actually hard tell what it means in detail. Seems like something we should fix as we presumably still care about the "Extensible Web".
The text was updated successfully, but these errors were encountered: