You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m building a project that is a bunch of plain HTML files with plain CSS and JS – there is no build step. I’m deploying this project to a server where I cannot control the headers being sent.
Because I can’t control the headers, I needed to add Speculation Rules by adding the following snippet to each and every HTML file:
changed the title [-]Allow authors to refer to a standalone JSON file for the speculation rules[/-][+]Allow external <script type=speculationrules>[/+]on Jan 31, 2025
Activity
tunetheweb commentedon Dec 6, 2024
As mentioned on chat, this is possible with plain JS:
And then have
inject-speculation-rules.jscontain something like this:But yeah it seems it would be nice to be able to do this directly.
[-]Allow authors to refer to a standalone JSON file for the speculation rules[/-][+]Allow external <script type=speculationrules>[/+]tunetheweb commentedon Feb 5, 2026
Intent to prototype in Chrome: https://groups.google.com/a/chromium.org/g/blink-dev/c/7ph2PcVZm6M
jspurlin commentedon Mar 3, 2026
Microsoft (Office Online) finds this enhancement interesting and thinks it sounds like a great addition to speculation rules!
johannesodland commentedon Jun 3, 2026
I came here with the same issue. Working on a site with pure HTML, CSS and JS. No build, no frameworks.
Would be great to have external speculation rules.
This goes for all new APIs. It gets very repetitive when configuration has to be repeated on every page.