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

Speculative Loading settings page showing Speculation Mode (Prefetch/Prerender) and Eagerness level (Conservative, Moderate, Eager) configuration

Features

Post-Installation

After installing the module, it works immediately with default settings. To customise:

  1. Navigate to "Configuration" > "Development" > "Performance" and open the "Speculative Loading" tab
  2. Keep "Enable speculative loading" checked, or uncheck it to stop adding rules without uninstalling
  3. Choose between "Prefetch" or "Prerender" mode (prerendering provides faster experiences but may affect interactive content)
  4. Select your preferred eagerness level
  5. Save your configuration

No additional setup is required as the module automatically adds the necessary markup to your pages.

Speculative Loading detailed settings showing speculation mode toggle between Prefetch and Prerender with eagerness level options

While not required, these core modules complement Speculative Loading:

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):

Community Documentation

The module generates speculation rules as a JSON snippet injected into each page, instructing the browser which links to prefetch or prerender:

Generated speculation rules JSON output showing the prefetch configuration with eagerness and URL matching rules added to the page source

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:

Speculative Loading is included in DXPR CMS, a Drupal distribution focused on performance and marketing team productivity.