demo · v131

Side-by-side: with vs without auto-preload

The companion slider demo lets you tune the SW startup cost. This one renders both timelines simultaneously: SW boot, fetch handler, and the network request — see exactly when auto-preload overlaps work and when it doesn't.

without auto-preload (pre-131 default)

browser
service worker

with auto-preload (browser mode, 131)

browser
service worker
pre-131 TTFB
ms
131 TTFB
ms

the api

// Server response header (no SW code needed)
Service-Worker-Auto-Preload: true

// Or per-registration via the ServiceWorker API
navigator.serviceWorker.register("/sw.js", {
  autoPreload: "browser"
});

see also