Speculation Rules

Speculation Rules (W3C draft) are the modern replacement for / . The browser reads a JSON document declaring patterns of links the operator wants speculatively loaded under varying eagerness levels (immediate, eager, moderate, conservative) and pre-fetches or pre-renders matching anchors as the user hovers / scrolls / dwells.

Two emit modes:

1. Speculation-Rules response header — points at a JSON document the operator serves elsewhere (typical for shared rules across many pages):

Speculation-Rules: "/rules/speculation.json"

The header form is the framework's default because it keeps HTML response bodies clean, lets the rules document be cached independently, and avoids touching response bodies (zero risk of body-parse / encoding mishaps).

2. Inline tag into text/html response bodies just before (or fallback before ). When cspNonce middleware has populated req.cspNonce, the injected