coderef

Speculation rulesLimited availability

Speculation rules are hints to the browser to proactively download pages in the background so they appear instantly when the user navigates to them.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–108Not supported
109+Supportedsince Jan 10, 2023
Current: 155
Edge
12–108Not supported
109+Supportedsince Jan 12, 2023
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–108Not supported
109+Supportedsince Jan 10, 2023
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Firefox, Safari, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: prerendering.

Feature detection

JS · check before using
if ("type" in document.createElement("script")) {
  // the type attribute/property of <script> is supported
}

Sub-features

Support for each part of the feature (25). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
Document.prerendering108108✕✕108✕✕
Document.prerenderingchange_event108108✕✕108✕✕
PerformanceNavigationTiming.activationStart108108✕✕57✕✕
Request.destination.speculationrules121121✕✕121✕✕
script.type.speculationrules109109✕✕109✕✕
script.type.speculationrules.eagerness121121✕✕121✕✕
script.type.speculationrules.expects_no_vary_search127127✕✕127✕✕
script.type.speculationrules.prefetch110110✕✕109✕✕
script.type.speculationrules.prerender109109✕✕109✕✕
script.type.speculationrules.referrer_policy111111✕✕111✕✕
script.type.speculationrules.relative_to121121✕✕121✕✕
script.type.speculationrules.requires110110✕✕109✕✕
script.type.speculationrules.requires.anonymous-client-ip-when-cross-origin110✕✕✕109✕✕
script.type.speculationrules.source_optional122122✕✕122✕✕
script.type.speculationrules.tag136136✕✕136✕✕
script.type.speculationrules.target_hint✕✕✕✕✕✕✕
script.type.speculationrules.urls109109✕✕109✕✕
script.type.speculationrules.where121121✕✕121✕✕
http.headers.Content-Security-Policy.script-src.inline-speculation-rules110110✕✕110✕✕
http.headers.Sec-Purpose.speculationrules110110✕✕110✕✕
Show 5 more
Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
http.headers.Sec-Speculation-Tags136136✕✕136✕✕
http.headers.Speculation-Rules121121✕✕121✕✕
http.headers.Supports-Loading-Mode109109✕✕109✕✕
http.headers.Supports-Loading-Mode.credentialed-prerender109109✕✕109✕✕
http.headers.Supports-Loading-Mode.fenced-frame117117✕✕117✕✕