From 558ea62ce83bacec4a2e0eb1a33322d1a8c3cb7e Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Fri, 8 Nov 2024 14:13:54 -0800 Subject: [PATCH] Improve docs in speculative loading plugin readme. --- plugins/speculation-rules/load.php | 2 +- plugins/speculation-rules/readme.txt | 26 +++++++++++--------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/plugins/speculation-rules/load.php b/plugins/speculation-rules/load.php index 36d74d2c78..ad186c06b6 100644 --- a/plugins/speculation-rules/load.php +++ b/plugins/speculation-rules/load.php @@ -2,7 +2,7 @@ /** * Plugin Name: Speculative Loading * Plugin URI: https://github.com/WordPress/performance/tree/trunk/plugins/speculation-rules - * Description: Enables browsers to speculatively prerender or prefetch pages when hovering over links. + * Description: Enables browsers to speculatively prerender or prefetch pages to achieve near-instant loads based on user interaction. * Requires at least: 6.5 * Requires PHP: 7.2 * Version: 1.3.1 diff --git a/plugins/speculation-rules/readme.txt b/plugins/speculation-rules/readme.txt index 475ce96c85..9de308792d 100644 --- a/plugins/speculation-rules/readme.txt +++ b/plugins/speculation-rules/readme.txt @@ -7,26 +7,24 @@ License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Tags: performance, javascript, speculation rules, prerender, prefetch -Enables browsers to speculatively prerender or prefetch pages when hovering over links. +Enables browsers to speculatively prerender or prefetch pages to achieve near-instant loads based on user interaction. == Description == -This plugin adds support for the [Speculation Rules API](https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API), which allows defining rules by which certain URLs are dynamically prefetched or prerendered based on user interaction. +This plugin adds support for the [Speculation Rules API](https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API), which allows defining rules by which certain URLs are dynamically prefetched or prerendered. See the [Speculation Rules WICG specification draft](https://wicg.github.io/nav-speculation/speculation-rules.html). -By default, the plugin is configured to prerender WordPress frontend URLs when the user hovers over a relevant link. This can be customized via the "Speculative Loading" section under _Settings > Reading_. +By default, the plugin is configured to prerender WordPress frontend URLs when the user interacts with a relevant link. This can be customized via the "Speculative Loading" section in the _Settings > Reading_ admin screen. -A filter can be used to exclude certain URL paths from being eligible for prefetching and prerendering (see FAQ section). Alternatively, you can add the 'no-prerender' CSS class to any link (`` tag) that should not be prerendered. See FAQ for more information. +A filter can be used to exclude certain URL paths from being eligible for prefetching and prerendering (see FAQ section). Alternatively, you can add the `no-prerender` CSS class to any link (`` tag) that should not be prerendered. See FAQ for more information. = Browser support = -The Speculation Rules API is a new web API, and the functionality used by the plugin is supported in Chromium-based browsers such as Chrome, Edge, or Opera using version 121 or above. Other browsers such as Safari and Firefox will ignore the functionality with no ill effects but will not benefit from the speculative loading. Note that extensions may disable preloading by default (for example, uBlock Origin does this). - -Other browsers will not see any adverse effects, however the feature will not work for those clients. +The Speculation Rules API is a new web API, and the functionality used by the plugin is supported in Chromium-based browsers such as Chrome, Edge, or Opera using version 121 or above. Other browsers such as Safari and Firefox will ignore the functionality with no ill effects; they will simply not benefit from the speculative loading. Note that certain browser extensions may disable preloading by default. * [Browser support for the Speculation Rules API in general](https://caniuse.com/mdn-html_elements_script_type_speculationrules) -* [Information on document rules syntax support used by the plugin](https://developer.chrome.com/blog/chrome-121-beta#speculation_rules_api) +* [Information on document rules syntax support used by the plugin](https://developer.chrome.com/docs/web-platform/prerender-pages) _This plugin was formerly known as Speculation Rules._ @@ -48,12 +46,11 @@ _This plugin was formerly known as Speculation Rules._ = How can I prevent certain URLs from being prefetched and prerendered? = -Not every URL can be reasonably prerendered. Prerendering static content is typically reliable, however prerendering interactive content, such as a logout URL, can lead to issues. For this reason, certain WordPress core URLs such as `/wp-login.php` and `/wp-admin/*` are excluded from prefetching and prerendering. Additionally, any URL generated with `wp_nonce_url()` (or which contain the `_wpnonce` query var) is also ignored. You can exclude additional URL patterns by using the `plsr_speculation_rules_href_exclude_paths` filter. +Not every URL can be reasonably prerendered. Prerendering static content is typically reliable, however prerendering interactive content, such as a logout URL, can lead to issues. For this reason, certain WordPress core URLs such as `/wp-login.php` and `/wp-admin/*` are excluded from prefetching and prerendering. Additionally, any URL generated with `wp_nonce_url()` (or which contains the `_wpnonce` query var) is also ignored. You can exclude additional URL patterns by using the `plsr_speculation_rules_href_exclude_paths` filter. -This example would ensure that URLs like `https://example.com/cart/` or `https://example.com/cart/foo` would be excluded from prefetching and prerendering. +The following example ensures that URLs like `https://example.com/cart/` or `https://example.com/cart/foo` are excluded from prefetching and prerendering: `