v151 · loading · speculation rules

Prefetch and activation, observed

The proposal associates its server request with the commit of a navigation that consumes a prefetched response. Trigger a real prefetch here, then navigate and let the target confirm prefetch consumption through deliveryType; that client observation does not prove a beacon was sent.

  1. 1 · Prefetch a same-origin page

    Click to inject a Speculation Rules script that prefetches ../activated-target/ with eagerness: "immediate". This is a real prefetch, made by this page.

    No prefetch requested yet.
  2. 2 · Activate it

    Navigate to the prefetched page. If the browser served it from the prefetch cache, its navigation entry reports deliveryType === "navigational-prefetch". That establishes prefetch consumption, but not whether a separately configured activation request reached a server.

    Navigate to target →

How it works

// referrer page
const s = document.createElement("script");
s.type = "speculationrules";
s.textContent = JSON.stringify({
  prefetch: [{ source: "list", urls: ["../activated-target/"], eagerness: "immediate" }]
});
document.head.appendChild(s);

// target page, after activation
const nav = performance.getEntriesByType("navigation")[0];
nav.deliveryType === "navigational-prefetch"; // served from prefetch; beacon still needs feature + valid response header

see also