EX-02 · Navigation · Browser platform
View transitions & prerendering
Two browser features make an ordinary multi-page site feel like an app, with no client-side router. Speculation rules prerender the next page while you hover a link, and cross-document view transitions animate from one real page load to the next. Every page on this site has both switched on.
- Transitions
@view-transition- Prerendering
speculationrules- JavaScript needed
- None
- Your browser
- Needs JavaScript to check
Try it
Hover a swatch for a moment, then click. The page is already rendered when you arrive, and the colour chip grows into its header. Step through the swatches with the arrows, then come back and compare the log below. Switch either feature off to feel the difference. The switches apply to the whole site until you turn them back on.
This navigation
First paint is measured from the moment you navigated. A prerendered page painted before you clicked, so it reads 0 ms.
Recent navigations
This page, shared in Discord
The card for this page is design D6 from Exhibit 01. Its media gallery holds an animated GIF of this site's own transitions, which Discord plays inline. A video in a gallery wouldn't autoplay.
The GIF is a real recording. scripts/record-gif.mjs drives Chromium through the swatches with every transition slowed 10×, keeps the frames Chrome actually presented, and retimes them to real speed.
How this site wires it
@media (prefers-reduced-motion: no-preference) {
@view-transition { navigation: auto; }
}
moderate starts on hover or pointer-down.<script type="speculationrules">
{
"prerender": [
{
"where": {
"and": [
{
"href_matches": "/*"
},
{
"not": {
"href_matches": "/api/*"
}
}
]
},
"eagerness": "moderate"
}
]
}
</script>
<!-- /view-transitions -->
<span style="view-transition-name: swatch-oxide">
<!-- /view-transitions/oxide -->
<div style="view-transition-name: swatch-oxide">
Field notes
Both pages must opt in
A cross-document transition only runs when the old and new page are same-origin and both have
@view-transition { navigation: auto; }. That's why the switch above has to apply to the whole site.One name per page
If two elements on a page share a
view-transition-name, the browser skips the whole transition. The tray names each chip after its swatch for that reason.Prerendered pages run early
A prerendered page runs its scripts before anyone sees it. Check
document.prerenderingand wait forprerenderingchangebefore counting a view. The log here waits the same way.The server can tell
Speculative fetches carry
Sec-Purpose: prefetch;prerender. The "Server saw" row above shows the header the Pages Function received for this page.Keep side effects out
The rules exclude
/api/*, and the switches are form POSTs, which are never prerendered. Don't point speculation rules at a URL that changes something when it's fetched.Eagerness is a budget
moderatewaits for a short hover or a pointer-down, so prerenders follow intent.eagerwould prerender every matching link straight away, and browsers cap how many prerenders they keep.Unsupported means ordinary
Browsers without these features ignore the rule and the script and simply navigate. Nothing breaks, so there's no feature detection to write.
Mind the back button
Back and forward usually restore from the back/forward cache instead, which is even faster than a prerender. The log shows these as their own kind of arrival.

