This repository was archived by the owner on Jun 30, 2023. It is now read-only.
This repository was archived by the owner on Jun 30, 2023. It is now read-only.
Merge prerender into preload and introduce "loadpolicy" #4
Closed
Description
preload
and prerender
have high functional overlap and subtle difference in processing policies. Further, current separation makes it impossible to implement some load+processing policies.
Proposal: merge prerender
into preload
and expose necessary fetch and execution controls via new loadpolicy
attribute. loadpolicy
consists of a space-separate set of keywords:
critical
: indicates critical resource that must be fetched immediately and with high priority.optional
: indicates an optional resource that may be used on current or next navigation and should be fetched with lower relative priority.inert
: fetch, do not process.prepare
: fetch and if possible preprocess/prepare the response - e.g. decode an image, prerender an HTML document.
Processing:
- If not specified, the default
loadpolicy
iscritical inert
. - When combined,
critical
overridesoptional
, but combination can be used to indicate that the resource is critical for current page and is likely to be used on next navigation - i.e. UA should not cancel fetch across navigations. - When combined,
prepare
overridesinert
.
Examples:
<!-- defaults to "critical inert" -->
<link rel="preload" as="image" href="//example.com/some.js">
<!-- critical image that is used across pages, prepare if possible -->
<link rel="preload" as="image"
href="//example.com/logo.jpg"
loadpolicy="critical optional prepare">
<!-- prefetch without execution (inert by default) -->
<link rel="preload" as="html"
href="//example.com/next-page.html"
loadpolicy="optional">
<!-- prerender -->
<link rel="preload" as="html"
href="//example.com/next-page.html"
loadpolicy="optional prepare">
There are multiple benefits to merging these hints:
- Clean distinction between
preconnect
vs.preload
:preconnect
is used when only host is known,preload
is used to define fetch and processing policy when resource URL is known. loadpolicy
is more expressive and enables new processing strategies - e.g. resource is used across pages; resource is critical and should be 'prepared' if possible.
Thoughts?
Metadata
Metadata
Assignees
Labels
No labels