Speculation-Rules header

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The HTTP Speculation-Rules response header provides one or more URLs pointing to text resources containing speculation rule JSON definitions. When the response is an HTML document, these rules will be added to the document's speculation rule set. See the Speculation Rules API for more information.

The resource file containing the speculation rules JSON can have any valid name and extension, but it will be requested with a destination type of speculationrules, and must be served with an application/speculationrules+json MIME type.

Note: This mechanism provides an alternative to specifying the JSON definition inside an inline <script type="speculationrules"> element. Specifying an HTTP header is useful in cases where developers are not able to directly modify the document itself.

Header type Response header

Syntax

http
Speculation-Rules: <url-list>

Directives

<url-list>

A comma-separated list of URLs pointing to text resources containing speculation rule JSON definitions. The JSON contained in the text files must follow the same rules as that contained inside inline <script type="speculationrules"> elements. See Speculation rules JSON representation for the syntax reference.

Examples

Speculation-Rules field with a single file

The following response contains one file reference:

http
Speculation-Rules: "/rules/prefetch.json"

Speculation-Rules field with multiple files

The following response contains multiple file reference as a comma-separated list:

http
Speculation-Rules: "/rules/prefetch.json","/rules/prerender.json"

Note: The URL values must be contained in quotes.

Specifications

Specification
HTML
# the-speculation-rules-header

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Speculation-Rules
Experimental
Chrome – Full support
Chrome 121 (Release date: 2024-01-23)
footnote Full support
Edge – Full support
Edge 121 (Release date: 2024-01-25)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 107 (Release date: 2024-02-07)
footnote Full support
Safari – No support
Safari 26.2 (Release date: 2025-12-12)
disabled
disabled From version 26.2 users must explicitly set the SpeculationRules prefetch preference.
Chrome Android – Full support
Chrome Android 121 (Release date: 2024-01-23)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 81 (Release date: 2024-03-14)
footnote Full support
Safari on iOS – No support
Safari on iOS 26.2 (Release date: 2025-12-12)
disabled
disabled From version 26.2 users must explicitly set the SpeculationRules prefetch preference.
Samsung Internet – Full support
Samsung Internet 25 (Release date: 2024-04-24)
footnote Full support
WebView Android – Full support
WebView Android 121 (Release date: 2024-01-23)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
User must explicitly enable this feature.

See also