Speculation Rules API gives PWAs instant navigation without service worker complexity
Modern PWAs can achieve native-like speed with declarative speculation rules instead of complex service worker prefetch logic.
The new performance primitive for PWAs
Service workers have long been the go-to tool for offline caching and prefetching. The Speculation Rules API offers a simpler, declarative alternative for navigation speed that browsers can optimize automatically.
For OpenPWA listings and detail pages, this means users experience near-instant page loads when clicking through news or app cards.
Implementation decision framework
Use Speculation Rules when:
- Your PWA has predictable navigation paths (listing → detail)
- You want to reduce Time to Interactive for second-page views
- You prefer declarative configuration over imperative JavaScript
Stick with service worker caching when:
- You need full offline support
- You have complex cache invalidation rules
- You must support older browsers without Speculation Rules
Production checklist
- [ ] Add a
<script type="speculationrules">block in your document head - [ ] Set conservative
eagernessvalues ("moderate" or "conservative") - [ ] Exclude authenticated or personalized routes from prerendering
- [ ] Monitor for increased data usage in analytics
- [ ] Test with Chrome 121+ and Edge 121+