demo · v144

Search-as-you-type Prerender

A search box that prerenders the top hit on each keystroke, but only activates the prerender after the user clicks. "until": "script" tells Chrome to keep the prerendered page warm in the background until your JS calls activatePrerender().

Speculation Rules + until-script: checking…

type in the box. each keystroke updates the speculation rule.

the API

<script type="speculationrules">
{
  "prerender": [{
    "source": "list",
    "urls": ["/docs/temporal"],
    "eagerness": "moderate"
  }],
  "until": "script"          // NEW in v144 — wait for our call
}
</script>
<script>
  link.addEventListener("click", () => navigator.activatePrerender(link.href));
</script>

see also