2 · Preload
Sparke fetches discovered pages into memory while the browser is idle.
With links discovered, Sparke fetches each target page into memory while the browser is idle. By the time you click, the page is usually already sitting in memory, ready to swap in with no request on the critical path.
Gentle by default
Preloading is throttled so it never competes with what matters. It runs during idle time and backs off under load, so the initial page stays responsive and you don't hammer your own server. Every preload fetch is marked with a request header so your server can tell idle prefetches apart from real navigations:
| Header | Meaning |
|---|---|
X-Sparke: preload |
Idle prefetch – not a user navigation yet. |
X-Sparke: navigate |
A real click or form submit. |
Because preload is a real credentialed GET fired before any
click, routes with side effects (logout, delete, unsubscribe)
must be POST, not GET links. Either make them
POST or exclude them - see
Side-effect routes.
A nice side effect: offline
Because preloaded pages live in memory, once the site has loaded and Sparke has preloaded its links you can drop your connection and keep navigating – every preloaded page still swaps in. Only genuinely server-side actions (POST forms, fresh data) need the network.
This is real, free offline navigation for a static or server-rendered site – no service worker to write or maintain.