This module is included in DXPR CMS.
Speculative Loading enables browsers to preload pages users are likely to visit next, creating near-instant navigation experiences on your Drupal site. By intelligently prefetching or prerendering pages based on user interactions, this module dramatically improves perceived performance without requiring complex technical setup.
You need Speculative Loading if
- You want to improve your site's perceived performance and navigation speed
- You need near-instant page loading without complex technical setup
- You want to implement modern browser performance features easily
- You're focused on user experience and reducing page load times
- You want performance improvements that work automatically with no ongoing maintenance

Features
- Implements the modern Speculation Rules API to improve website performance
- Supports both prefetch (lightweight) and prerender (full-page) modes
- Configurable eagerness levels (Conservative, Moderate, or Eager) to balance performance and resource usage
- No code required: works automatically on standard Drupal frontend pages
- Frontend pages only: administration pages are skipped automatically
- Enable or disable output without uninstalling the module
- "No-prerender" CSS class can be added to exclude specific links
- Hook API allows adding or removing excluded URL patterns
- Plugin system for extending functionality with custom rules and exclusions
Post-Installation
After installing the module, it works immediately with default settings. To customise:
- Navigate to "Configuration" > "Development" > "Performance" and open the "Speculative Loading" tab
- Keep "Enable speculative loading" checked, or uncheck it to stop adding rules without uninstalling
- Choose between "Prefetch" or "Prerender" mode (prerendering provides faster experiences but may affect interactive content)
- Select your preferred eagerness level
- Save your configuration
No additional setup is required as the module automatically adds the necessary markup to your pages.

Recommended modules/libraries
While not required, these core modules complement Speculative Loading:
- BigPipe - Progressive page rendering for the initial load; Speculative Loading handles subsequent navigations
- Internal Page Cache - Caches full pages for anonymous users, making prerendered pages even faster to serve
Supporting this Module
This module is maintained by DXPR. If you find it valuable, consider checking out our free page builder (with paid features for large websites):
The module generates speculation rules as a JSON snippet injected into each page, instructing the browser which links to prefetch or prerender:

Browser Support
The Speculation Rules API is supported in modern Chromium-based browsers (Chrome, Edge, Opera). Other browsers will gracefully ignore the functionality with no negative effects.
Wider browser support is underway: Firefox is actively working on implementing the Speculation Rules API. You can track their progress here: Firefox Bug #1969396
FAQ
- Which browsers support the Speculation Rules API?
-
Chromium-based browsers (Chrome, Edge, Opera) fully support the Speculation Rules API. Firefox is actively implementing support (tracked in Bug #1969396). Browsers that do not support the API simply ignore the speculation rules with no negative effects on functionality or performance. The module is safe to enable on any site.
- What is the difference between prefetch and prerender mode?
-
Prefetch downloads the page's resources (HTML, CSS, JavaScript) in advance but does not execute them. Prerender goes further and fully loads and renders the page in a hidden tab, making navigation appear instant. Prerender provides faster experiences but uses more bandwidth and may affect pages with interactive content or analytics tracking.
- Does Speculative Loading increase server load?
-
The processing happens entirely in the visitor's browser; the module only adds a small JSON snippet to each page telling the browser what to preload. Server load depends on how aggressively browsers prefetch pages and how many visitors your site has. The eagerness setting (Conservative, Moderate, or Eager) controls how many pages browsers preload.
- Are administration pages affected?
-
No. Speculative Loading adds speculation rules to frontend pages only. Administration pages are skipped automatically, and administrative paths, user account pages and other sensitive URLs stay excluded from prefetching and prerendering, so editorial and administrative work is never affected.
- Which URLs are excluded by default?
-
Administrative paths, user login, logout, registration, password and edit pages, password reset and confirmation paths, content editing paths, URLs with query strings, and file, module and theme assets. Use the documented hook to add or remove excluded site paths, or add the "no-prerender" class to individual links.
Related Modules
Modules that complement Speculative Loading for Drupal performance:
- BigPipe - Drupal core module for progressive page rendering; works alongside Speculative Loading to reduce both initial and subsequent page load times
- Internal Page Cache - Drupal core caching for anonymous users; caches the pages that Speculative Loading prerenders
- DXPR Theme - Responsive Drupal theme with built-in performance optimizations
- DXPR Builder - Drag-and-drop page builder for Drupal
Speculative Loading is included in DXPR CMS, a Drupal distribution focused on performance and marketing team productivity.