{"id":165655,"date":"2024-01-19T08:00:00","date_gmt":"2024-01-19T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/speculation-rules\/"},"modified":"2025-08-26T03:25:00","modified_gmt":"2025-08-26T03:25:00","slug":"speculation-rules","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/speculation-rules\/","title":{"rendered":"Speculative Loading"},"content":{"rendered":"<p>This plugin adds support for the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Speculation_Rules_API\" rel=\"nofollow ugc\">Speculation Rules API<\/a>, which allows defining rules by which certain URLs are dynamically prefetched or prerendered. This core Speculative Loading functionality was <a href=\"https:\/\/make.wordpress.org\/core\/2025\/03\/06\/speculative-loading-in-6-8\/\" rel=\"nofollow ugc\">merged into WordPress 6.8<\/a>, but it only prefetches with conservative eagerness by default. In contrast, this plugin defaults to prerendering with moderate eagerness (i.e. when interacting with a link), and it provides a user interface to customize the mode and eagerness via the \u201cSpeculative Loading\u201d section on the <em>Settings > Reading<\/em> admin screen.<\/p>\n<p>By default, speculative loading is only enabled for logged-out users, since unauthenticated pages are typically only eligible for caching and so more efficient to prefetch\/prerender. This means that sites with frequent logged-in users on the frontend\u2014such as e-commerce, forums, or membership sites\u2014will not benefit from the feature. If your server can handle the additional load (for example, with persistent object caching), you can opt in to enable speculative loading for all logged-in users or for administrators only. This setting exclusively affects frontend pages; admin screens are always excluded.<\/p>\n<p>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 <code>no-prerender<\/code> CSS class to any link (<code><a><\/code> tag) that should not be prerendered. See FAQ for more information.<\/p>\n<h4>Browser support<\/h4>\n<p>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.<\/p>\n<ul>\n<li><a href=\"https:\/\/caniuse.com\/mdn-html_elements_script_type_speculationrules\" rel=\"nofollow ugc\">Browser support for the Speculation Rules API in general<\/a><\/li>\n<li><a href=\"https:\/\/developer.chrome.com\/docs\/web-platform\/prerender-pages\" rel=\"nofollow ugc\">Information on document rules syntax support used by the plugin<\/a><\/li>\n<\/ul>\n<p><em>This plugin was formerly known as Speculation Rules.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Enables browsers to speculatively prerender or prefetch pages to achieve near-instant loads based on user interaction.<\/p>\n","protected":false},"author":65,"featured_media":349659,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Speculative Loading - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Enables browsers to speculatively prerender or prefetch pages to achieve near-instant loads based on user interaction."},"footnotes":""},"categories":[1],"tags":[826,64,6630,8408,42646],"class_list":["post-165655","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-javascript","tag-performance","tag-prefetch","tag-prerender","tag-speculation-rules"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/165655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=165655"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/165655\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/349659"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=165655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=165655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=165655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}