Created
May 19, 2024 18:25
-
-
Save nucliweb/1b103bb838c154664d4914508925ea45 to your computer and use it in GitHub Desktop.
Speculation Rules Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (HTMLScriptElement.supports?.('speculationrules')) { | |
const specScript = document.createElement('script') | |
specScript.type = 'speculationrules' | |
const specRules = { | |
prerender: [{ | |
urls: ['/next.html'], | |
}, ], | |
} | |
specScript.textContent = JSON.stringify(specRules) | |
document.body.append(specScript) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment