Speculation Rules Generator
Generate a valid Speculation Rules JSON for Prefetch and prerender; validate safe presets, URL patterns, and eagerness options in your browser.
Presets
Presets change the operation type and trigger sensitivity together.
Rule Behavior
Choose what the browser should prepare, from which source, and how early.
URL Scope
Enter a URLPattern pattern or a target URL on each line.
/blog/* or /products/:slug /pricing/ such as relative or https://example.com/pricing/ Write an absolute URL such as. Live Syntax and Risk Audit
The JSON structure, URLPattern inputs, and resource consumption choices are checked instantly.
Generated Code
1 rule · 1 target/pattern
About Speculation Rules Generator
Speculation Rules API, prefetches (prefetch) or complete preparation in the background (prerender) instruction. When used correctly, it can significantly speed up subsequent page transitions; when used too broadly, it can unnecessarily consume bandwidth, server resources, and analytics measurements.
This tool; conservative, moderate and aggressive generates a rule from URLPattern patterns or an explicit URL list using presets. Add the output as plain JSON or as <script type="speculationrules"> You can receive it in the form of. The syntax, the CSS exclusion selector, and risky combinations are checked entirely in your browser.
Browsers that do not support Speculation Rules ignore this script type; normal links continue to work. Therefore, when configured correctly, the feature is an additional acceleration layer and does not replace the existing navigation flow.
Step by step
- Suitable for your traffic and resource usage Conservative, Moderate or Aggressive Select the preset.
- Lighter to process prefetch or the one that prepares the page completely prerender make the selection.
- Scope URL pattern or explicit URL list Define it with; exclude session, cart, and checkout paths.
- Resolve the syntax and resource consumption warnings in the live validation field.
- Copy the generated HTML tag or JSON output, or download it as a file.
Frequently Asked Questions
prefetch allows the target document to be prefetched from the network; it does not run the page. prerender then loads and renders the target page as if it were in an invisible tab. Prerender can provide faster transitions, but it should be used more carefully because JavaScript, network requests, and analytics events may run before the click.conservative expects strong user intent; moderate uses a signal such as a brief delay on the link. eager and especially immediate can run earlier and consume more resources. The browser may still choose not to apply a rule depending on the browser, device, and network conditions.type="speculationrules" Check the script as well. Instead of adding a second conflicting rule, use wp_speculation_rules_configuration Customize the core configuration with the filter.<a href> links work unchanged; no special JavaScript polyfill is required. Therefore, do not connect link targets only to Speculation Rules, and preserve the normal navigation flow.