Speculative Loading: Site Booster Module
The Ocean Site Booster's Speculative Loading module enables you to add an extra speed kick to the way your website pages are loading.
The Speculative Loading module uses the browser's Speculation Rules API to predict which page a user will click next. By pre-loading or prerendering that page in the background, Site Booster makes your site feel "instant".
To access the Speculative Loading module, navigate to the Optimization panel, select the Speculative Loading tab, and toggle to enable the Speculative Loading module.
Enable (or disable) any option you would like to use, then save changes at the bottom of the module page.
Available Speculative Loading options include:
- Eagerness Mode,
- Exclude URL Paths,
- Prerender Only,
- Enable for Logged-In Users,
- Enable Without Pretty Permalinks.
Recommended:
- Speculative Loading Best Practices & Warnings,
- Speculative Loading: 3-Step Quick Start,
- Advanced Troubleshooting,
- Managing Server Impact,
- Security & Privacy FAQ.
Eagerness Mode
The Eagerness Mode defines the "trigger" for speculative loading:
- Eager: Loads as soon as a link is visible.
- Moderate: Loads when a user hovers over a link for a short duration (Best balance/Recommended).
- Conservative: Loads only when the user clicks down on the mouse.
Exclude URL Paths
Prevents specific pages from being preloaded. Always exclude dynamic paths like /cart/*, /checkout/*, or custom logout URLs to prevent accidental actions.
To ensure the best performance and prevent "ghost" actions (like items being added to a cart twice), we recommend adding the following paths to your Exclude URL Paths box:
1. Essential WordPress Paths
These should almost always be excluded to protect the login and administration areas.
/wp-admin/*/wp-login.php/wp-json/*(API endpoints don't need to be rendered)
2. eCommerce (WooCommerce)
Prevents the browser from pre-loading checkout sessions or empty carts.
/cart/*/checkout/*/my-account/*/?add-to-cart=*
3. Dynamic & Interactive Paths
Exclude pages where a "visit" triggers a specific change or heavy server process.
/logout/*/search/*(prevents the server from running multiple search queries as users hover over links)/*?action=*(any URL that performs an action)
Prerender Only
If enabled, the browser will fully render the page in the background (using more CPU/RAM of your site visitor's PC).
If disabled, it will just prefetch the files.
Pro Tip: If your audience primarily uses high-end desktop computers, Prerender Only offers the best "wow" factor. If your audience is mostly on older mobile devices or limited data plans, leaving this OFF (allowing simple prefetching) is a more polite use of their device's resources.
Enable for Logged-In Users
Use with caution.
Preloading pages while logged in can trigger server-side processes. Usually best kept OFF unless your site is mostly static for members.
Enable Without Pretty Permalinks
Allows the feature to work on sites using ?p=123 slug structures. Most modern sites use Pretty Permalinks, so this is rarely needed.
Speculative Loading Best Practices & Warnings
When NOT to Enable Speculative Loading:
- Low-Powered Hosting: If your server struggles with normal traffic, speculative loading can double or triple your server hits, as it loads pages the user might not even visit.
- Heavy Analytics/Ads: If your tracking scripts don't properly detect "prerender" states, your analytics might show inflated pageviews.
- Dynamic Actions: Never enable on URLs that perform an action (eg,
?action=deleteor/add-to-cart).
Pro-Tip for Developers
If you use Google Analytics 4 (GA4), it automatically handles most speculative loads correctly. However, if you use custom tracking scripts, ensure they are compatible with the document.prerendering state so your data stays 100% accurate.
Speculative Loading: 3-Step Quick Start
Follow these three steps to ensure your site feels faster without overloading your server.
1. The "Safety First" Check
Before doing anything else, ensure your Exclude URL Paths box includes your sensitive pages.
2. Choose Your "Eagerness"
- New to Performance? Select Moderate (on hover with delay). This is the "sweet spot" that prevents accidental loads while still making the site feel snappy.
- On High-End Hosting? If you have a powerful server (VPS or Dedicated), try Eager (on hover) for that "instant" feel.
3. The "Real-World" Verification
Don't just take our word for it, see it in action!
- Open your site in a Chrome Incognito window (to ensure you're viewing it as a visitor).
- Right-click and select Inspect, then click the Network tab.
- Slowly hover your mouse over a blog post or service page link.
- The Magic: You should see the page file appear in the Network list before you click. If it does, your Site Booster is officially making your site feel like it's running on a supercomputer.
Advanced Troubleshooting
Why don't I see speeds improving in Firefox or Safari?
The Speculation Rules API is a cutting-edge technology currently supported primarily by Chromium browsers (Chrome, Edge, Brave, and Opera).
- Chrome/Edge Users: Will experience near-instant "prerendered" transitions.
- Safari/Firefox Users: The plugin will remain dormant and won't interfere with their browsing, ensuring your site remains stable across all platforms.
Conflict with Security Plugins
If you use a high-security Content Security Policy (CSP), you may need to "allow" the speculationrules type. Most users will not need to do this, as the module is built to be compatible with standard WordPress environments.
CSP Compatibility: If you have the Site Booster's Security Headers module enabled with a custom Content Security Policy (CSP), you must ensure your policy allows speculation rules.
- What to do: In the Security Headers module, ensure your
script-srcdirective includes'inline-speculation-rules'. - Why? Without this, your browser's security policy might block the Site Booster from "seeing" the links it needs to preload.
Managing Server Impact
While the visitor’s computer handles the rendering, your server still has to deliver the data. If you have a high-traffic site on shared hosting, keep these tips in mind:
- Stick to "Moderate" Eagerness: This ensures you only load pages the user is actually interested in (by waiting for a hover delay) rather than loading every link they scroll past.
- Monitor your Analytics: If you see a sudden spike in "Unique Visits" but a drop in "Time on Page," your analytics tool might be counting speculative loads.
- Use Caching: Speculative loading works best when paired with a good page caching system. This way, when the browser "asks" for a page to prerender, your server just hands over a pre-made file instead of building the page from scratch.
Security & Privacy FAQ
Is the Speculative Loading module safe?
Yes. Site Booster uses the modern Speculation Rules API.
Unlike older methods that used heavy JavaScript, this module injects a secure JSON configuration block that the browser reads.
- No Executable Scripts: The code added to your site is "non-executable", meaning it cannot be used to run malicious commands.
- Data Integrity: All inputs are strictly sanitized using WordPress best practices to ensure no unauthorized code can be injected into your pages.
Does this affect my Analytics?
Speculative loading is designed to be "invisible". Modern browsers are intelligent enough to hold off on firing certain tracking pixels until the user actually clicks the link.
However, if you notice a slight "ghost" increase in traffic, we recommend using a modern analytics provider that supports the document.prerendering API.
Found an error in this doc or believe it needs improvement?
Send us a prepurchase ticket, include the URL of the page, and add suggestions and more details about how we can make things better for you.
That's it!
Boost your WordPress website on all levels with OceanWP and Ocean Site Booster.