Skip to content

Speculation Rules API #1081

Closed
Closed

Description

@BearCooder

Description

Link to last year submission & discussion:
#754

The Speculation Rules API is designed to improve performance for future navigations. It targets document URLs rather than specific resource files, and so makes sense for multi-page applications (MPAs) rather than single-page applications (SPAs).

The Speculation Rules API provides an alternative to the widely-available feature. It provides many improvements over these technologies, along with a more expressive, configurable syntax for specifying which documents should be prefetched or prerendered.

Specification

https://wicg.github.io/nav-speculation/speculation-rules.html

Additional Signals

Webkit: WebKit/standards-positions#54
Mozilla: mozilla/standards-positions#620

Tests:
https://wpt.fyi/results/speculation-rules?label=master&label=experimental&aligned&q=speculation

Info about:

Specification

https://wicg.github.io/nav-speculation/speculation-rules.html

web-feature

https://web-platform-dx.github.io/web-features-explorer/features/speculation-rules/

Test Links

https://wpt.fyi/results/speculation-rules?label=master&label=experimental&aligned&q=speculation

Additional Signals

No response

Activity

  1. github-actions commented on Sep 15, 2025

    @github-actions

    This comment was automatically generated based on the information you provided. Please don't edit it.

    Below is additional information about the web feature (from the web-features project) which is referenced in your proposal.
    If this doesn't accurately correspond to your proposal, please update your initial comment to include web-features: <feature-id>.
    To find feature IDs, use the web-features explorer.

    Feature Speculation rules

  2. tvereecke commented on Sep 17, 2025

    @tvereecke

    Speculation Rules is an easy to use API offering amazing performance benefits, having this API available in all browsers would make the web a better and faster place.

  3. stoyan commented on Sep 18, 2025

    @stoyan

    After some successful experimentation [*] with this API (more specifically with prefetch), I started looking into polyfilling it for non-Chromium browsers, that's how good the performance results are. While in Firefox we can fall back to <link prefetch>, in Safari even that's not an option. And this is only the prefetch. The prerendering, which is even more exciting, is pretty much impossible to polyfill.

    [*] I can't wait to share the results, I'll come back and link when they are official

  4. BearCooder commented on Sep 20, 2025

    @BearCooder
    Author

    Thanks @stoyan I opened a rquest for rel attributes interopability in browsers including the prefetch attribute: #1106

  5. kanashimia commented on Sep 25, 2025

    @kanashimia

    While in Firefox we can fall back to <link prefetch>, in Safari even that's not an option.

    For context Safari seems to support link preload, although that is slightly different, and you can also just fetch and cache stuff using javascript apis, so it is possible to do something there too just with some drawbacks.
    Examples:
    https://github.com/GoogleChromeLabs/quicklink/blob/main/src/prefetch.mjs
    https://github.com/midzer/prespeculation

    Would be much nicer if speculation rules were supported though, browsers diverge in this aspect too much.

  6. cullophid commented on Sep 27, 2025

    @cullophid

    It would be great to see cross browser support!

    Out of curiosity when was this implemented as a script rather than an attribute on ?

  7. yoavweiss commented on Oct 8, 2025

    @yoavweiss

    Shopify supports the inclusion of speculation rules in Interop 2026.

    We've seen significant performance benefits from using speculation rules on Shopify storefronts - 130-180ms improvement across all loading metrics and (almost) all percentiles.

    We're also actively implementing the feature in WebKit, behind a flag.

  8. wpt-interop commented on Feb 12, 2026

    @wpt-interop
    Collaborator

    Thank you for proposing Speculation Rules API for Interop 2026.

    We want to let you know it was not selected to be part of Interop this year.

    On behalf of the entire Interop team, thank you for submitting it for consideration. We got many more proposals than we could include in this year's project, necessitating some difficult choices. Please note this should not be taken as a comment on the technology as a whole, or our willingness to consider it for Interop in the future. We appreciate the work you put into your proposal, and would welcome your participation in future rounds of Interop.

    Posted on behalf of the Interop team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    focus-area-proposal

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions