SwissUpLabs Logo

Speculation Rules

Description

Speculation rules take the form of a JSON structure that determines what resources should be prefetched or prerendered by the browser. This is part of the Speculation Rules API

The Speculation Rules API is a JSON-defined API developed by Google to enhance the performance of web page loading through speculative loading strategies. One more description by Mozilla MDN.

How Does It Work?

Google’s Speculation Rules API is designed to target document URLs rather than specific resource files. The Speculation Rules API introduces a more expressive and configurable syntax for specifying which documents should be prefetched or prerendered. With a structure defined in JSON format within a script type="speculationrules", developers can articulate rules for both prerendering and prefetching. This enhanced flexibility allows for fine-tuning speculative loading.

Pagespeed Impact

Prerender with the Speculation Rules API

Browser Support

Can I use Speculation Rules?

Contents

  1. Installation
  2. Configuration
  3. Changelog
Edit this Page