Module Proposal: Speculation prerendering & prefetching with the Speculation Rules API #897
Labels
[Plugin] Speculative Loading
Issues for the Speculative Loading plugin (formerly Speculation Rules)
Overview
About the module
Purpose
The Speculation Rules API is a relatively new browser API which allows "speculative" prefetching and prerendering. Historically, prefetching and prerendering has only been possible for specific "hard-coded" resources, which in reality is often difficult or even unrealistic to get right across an ever-changing website. The Speculation Rules API allows sites to define certain rules to dynamically prefetch and prerender certain resources, e.g. when the user hovers over or clicks on a link to another URL.
This proposed module enables prefetching and prerendering with the new API. The necessary API capabilities will only become publicly available in Chrome 121 (likely January 2024), and right now they can be used with an origin trial (see #733). As such, the plan is to develop this module in a feature branch and only launch it once the feature is rolled out publicly and once the minimum requirements agreed for the module on have been implemented.
Scope
wp-login.php
, or anything inwp-admin
). This list should be customizable so that plugins that implement more dynamic capabilities on certain URLs can exclude those as well.The first two points above are already being implemented in #733. The remaining points would be implement in follow up pull requests against the feature branch
feature/speculationrules
.Rationale
WordPress has supported prefetching and prerendering via
link
tags for several years, however using those tags correctly is difficult. It is furthermore challenging from an ecosystem perspective: For instance, if every plugin was going to add their resources to be prefetched or prerendered, it would eventually defeat the purpose (if everything is a priority, nothing is a priority). A more objective, rule based approach like one the Speculation Rules API offers makes more sense. As described above, such a dynamic approach is also easier to use and has the potential to unlock prefetching and prerendering capabilities for a large part of the WordPress ecosystem and the overall web.Other
Learn more about the Speculation Rules API:
The text was updated successfully, but these errors were encountered: