Skip to content

Instantly share code, notes, and snippets.

@tunetheweb
Last active June 7, 2024 18:01
Show Gist options
  • Save tunetheweb/98a1324b0624d8c90e046e69c7069a24 to your computer and use it in GitHub Desktop.
Save tunetheweb/98a1324b0624d8c90e046e69c7069a24 to your computer and use it in GitHub Desktop.
Inject Speculation Rules
// Paste this into console to prerender all links on hover
function prerenderInAction() {
const script_ = document.createElement('script');
script_.type = 'speculationrules';
script_.textContent = `
{
"prerender": [
{
"where": {
"href_matches": "/*"
},
"eagerness": "moderate"
}
]
}
`;
document.head.appendChild(script_);
}
prerenderInAction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment