=== Speculative Loading === Contributors: wordpressdotorg Requires at least: 6.4 Tested up to: 6.5 Requires PHP: 7.0 Stable tag: 1.2.0 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. == 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. 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_. 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. = Browser support = The Speculation Rules API is a new web API, and the specific syntax used by the plugin currently requires using Chrome 121+. Other browsers will not see any adverse effects, however the feature will not work for those clients. * [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) _This plugin was formerly known as Speculation Rules._ == Installation == = Installation from within WordPress = 1. Visit **Plugins > Add New**. 2. Search for **Speculative Loading**. 3. Install and activate the **Speculative Loading** plugin. = Manual installation = 1. Upload the entire `speculation-rules` folder to the `/wp-content/plugins/` directory. 2. Visit **Plugins**. 3. Activate the **Speculative Loading** plugin. == Frequently Asked Questions == = 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. 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. `