Prerender
If the user then chooses to navigate to the page, display of its content can be near instant.
Prerendering might be used, for example, to fetch the page resources linked by a "Next" button, or a link popup that a user hovers over, or the likely page target of the URL being entered into the address bar. The following speculation rules
could be included in the head of a document to hint to the browser that it should prerender next.html
and next2.html
, as either might reasonably be a target of the next navigation:
<
script
type
=
"
speculationrules"
>
{
"prerender"
:
[
{
"source"
:
"list"
,
"urls"
:
[
"next.html"
,
"next2.html"
]
}
]
}
</
script
>
Prerendering results in faster display time than prefetching and hence a better user experience, at the cost of more resources being consumed.
See also
- Speculative loading
- prefetch
- Prerender pages in Chrome for instant page navigations on developer.chrome.com (2023)
- Speculation Rules API