blocks, parses the JSON, validates prerender/prefetch rules, eagerness levels, and URL predicate patterns. Chrome 121+ can instantly render next-page clicks.">
← jwatte.com

Speculation Rules API Audit

Speculation Rules are Chrome 121+ (Jan 2024) native prerendering — the next page is fully rendered in the background. Done right, link clicks feel instant. The audit checks your speculation rules JSON for shape and eagerness.

📖 Context & background

Read the story behind this tool: Why this tool exists — performance stack.

\n\n2. Use eagerness: "moderate" for prerender — Chrome prerenders on hover/focus.\n3. Use eagerness: "conservative" for prefetch — Chrome prefetches on mousedown / touchstart.\n4. Exclude URLs that are state-mutating (logout, delete, buy, auth). Use the "not" predicate.\n5. Exclude URLs likely to cause bandwidth / cost surprises (video pages, big-image pages) unless you have CDN bandwidth to spare.\n6. Test: in Chrome, open DevTools → Application → Speculative loads. Verify prerender runs on hover.\n7. If server-side logic relies on an HTTP request happening ONLY when user actually navigates, be aware: prerender hits your server early. Add Sec-Purpose: prefetch;prerender detection and avoid writes on those requests.\n8. For non-Chrome browsers: quicklink (https://github.com/GoogleChromeLabs/quicklink) is the polyfill.';const fp=(window.jwTool&&window.jwTool.enhancePrompt)?window.jwTool.enhancePrompt(fix,{persona:{role:'a senior front-end performance engineer',expertise:'Speculation Rules API (Chrome 121+), Sec-Purpose header, prerender vs prefetch tradeoffs, state-mutating URL exclusion',approach:'moderate-eagerness-first, exclude-mutating-urls, measure via DevTools Speculative Loads'},stakes:'Speculation rules can make navigation feel instant (0ms) but also waste bandwidth. Get eagerness + exclusions right.'}):fix;const sc=(window.jwAuditScorecard?window.jwAuditScorecard.render(findings,{title:'Speculation Rules',toolLabel:'Speculation'}):'');document.getElementById('results').innerHTML=sc+'

Findings

'+findings.map(renderChk).join('')+'
'+(scripts.length?'

Current speculation rules

'+esc(scripts.map(s=>s.raw).join('\n\n'))+'
':'')+'

Fix prompt

'+esc(fp)+'
';document.getElementById('results').style.display='block';try{window.jwAugmentCheckLinks&&window.jwAugmentCheckLinks({rootSelector:'#results',targetUrl:url});}catch(_){}}catch(e){document.getElementById('results').innerHTML='

Audit failed: '+esc(e.message)+'

';document.getElementById('results').style.display='block';}finally{document.getElementById('loading').style.display='none';}});