WordPress released an official plugin that adds support for a cutting-edge technology called speculative loading that can help increase site performance and improve the user experience for site visitors.
Speculative charge
Speculative loading is a technique that fetches pages or resources before a user clicks a link to navigate to another web page.
The official WordPress page about this new functionality describes it:
“The Speculation Rules API is a new web API… Allows you to define rules to dynamically fetch and/or pre-render URLs of a given structure based on user interaction, in JSON syntax, or in other words, speculatively preload those URLs before browsing.
This API can be used, for example, to pre-render links on a page whenever the user hovers over them. Also, with the Speculation Rules API, “prerender” actually means to pre-render the entire page, including the JavaScript execution. This can result in near-instant load times once the user clicks the link, as the page would likely have already loaded in its entirety. However, this is only one of the possible configurations.”
The new WordPress plugin adds support for the Speculation Rules API. Mozilla’s developer pages, a great resource for technical understanding of HTML, describe it this way:
“The Speculation Rules API is designed to improve performance for future browsing. It targets document URLs rather than specific resource files, so it makes sense for multi-page applications (MPAs) in Single Page Application (SPA) site.
The Speculation Rules API provides an alternative to the available extension and is designed to replace the deprecated one for Chrome only characteristic It provides many improvements over these technologies, along with a more expressive and configurable syntax for specifying which documents should be retrieved or pre-rendered.”
Performance Lab plugin
The new plugin was developed by the official WordPress performance team, which occasionally releases new plugins for users to test before possible inclusion in the actual WordPress core. So it’s a good opportunity to be the first to try new performance technologies.
The new WordPress plugin is configured by default to pre-render “WordPress Interface URLs” which are pages, posts and archive pages. Its operation can be adjusted in the settings:
Settings > Reading > Speculative Loading
Browser compatibility
Chrome 108 supports the Speculative API, but the specific rules used by the new plugin require Chrome 121 or higher. Chrome 121 was released in early 2024.
Non-supporting browsers will simply ignore the plugin and have no effect on the user experience.
Check out the new Speculative Loading WordPress plugin developed by the official WordPress Core Performance Team.
Speculative loading by the WordPress performance team
[ad_2]
Source link