Module Speculation Rules
swissup/module-speculation-rules
Implements Google's Speculation Rules API for Magento 2, enabling speculative loading strategies to improve page load performance. Uses JSON configuration for prefetching and prerendering URLs.
Build Tests
Code Quality
Tested on Magento 2.4.8-p3
Recent Test History
Each release is tested against the latest Magento version at that time.
Share This Module's Status
README
Loaded from GitHubMagento 2 Speculation Rules module
Description
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?
Installation
For clients
cd <magento_root>
composer require swissup/module-speculation-rules
bin/magento module:enable Swissup_SpeculationRules Swissup_Core
bin/magento setup:upgrade
For maintainers
cd <magento_root>
composer require swissup/module-speculation-rules:dev-master --prefer-source
bin/magento module:enable Swissup_SpeculationRules Swissup_Core
bin/magento setup:upgrade
This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.