Skip to content

Conversation

@vickiez
Copy link

@vickiez vickiez commented Sep 24, 2025

Add external <script type="speculationrules">

Allows a speculation rules script element to have a src pointing to a
file of speculation rules, enabling developers to easily reuse a set of
speculation rules across HTML documents.

WICG/nav-speculation#348

Spec changes:


  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: https://issues.chromium.org/issues/40170951
    • Gecko: …
    • WebKit: …
    • Deno (only for timers, structured clone, base64 utils, channel messaging, module resolution, web workers, and web storage): …
    • Node.js (only for timers, structured clone, base64 utils, channel messaging, and module resolution): …
  • Corresponding HTML AAM & ARIA in HTML issues & PRs:
  • MDN issue is filed: …
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


/scripting.html ( diff )
/speculative-loading.html ( diff )
/webappapis.html ( diff )

@vickiez vickiez force-pushed the spec-rules-external-script branch from 0f1c473 to 59d995a Compare December 10, 2025 12:51
@vickiez vickiez marked this pull request as ready for review December 10, 2025 13:29
Copy link
Collaborator

@noamr noamr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! See initial comments.

source Outdated
data-x="concept-request-url">URL</span> is <var>url</var>, <span
data-x="concept-request-client">client</span> is <var>document</var>'s <span>relevant settings
object</span>, <span data-x="concept-request-destination">destination</span> is "<code
data-x="">speculationrules</code>", and <span data-x="concept-request-mode">mode</span> is
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This destination needs to be defined in the fetch spec.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a change in progress here: whatwg/fetch#1841. Happy to help with that one, is there a proper order for merging the changes across specs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging them as close together as possible provided they are both unblocked and generally agreed upon is fine. But regarding this PR: is there cross-browser interest in this feature overall? The PR template is pretty scant.

@domfarolino
Copy link
Member

See #11697 (comment), but just so the sentiment doesn't get lost in that thread, let me ask here: is there cross-browser support for this? I'm asking because the PR template is a bit bare and I'm not sure where other folks stand on this PR, although I'm happy to review it.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants