Speculative Loading (Speculation Rules API)

Updated on 12. 6. 2025

Speculative Loading with Speculation Rules API

What is Speculative Loading?

Speculative loading uses modern browser APIs to preload or prerender pages that users are likely to visit, dramatically improving perceived loading speeds.

How It Works

ZiziCache implements the Speculation Rules API to:

  • Prefetch resources for likely navigation targets
  • Prerender entire pages in the background
  • Activate instantly when users click prerendered links

Configuration Options

Configure in Advanced � Speculative Loading:

Loading Modes

  • Prefetch: Download resources only
  • Prerender: Fully render pages in background
  • Off: Disable speculative loading

Eagerness Levels

  • Conservative: Only on hover/focus
  • Moderate: Balanced approach (recommended)
  • Eager: Immediate preloading

Advanced Configuration

Conditional Activation

  • Enable only on specific page types
  • Home page, posts, pages, archives, search results
  • Custom page type targeting

Security and Privacy

  • Same-origin restriction: Limit to your domain only
  • HTTPS requirement: Only work on secure connections
  • IP anonymization: Enhanced privacy protection

Exclusion Patterns

Exclude specific URLs from speculative loading:

  • Admin areas: /wp-admin/*
  • Account pages: /account/*
  • External links: https://external-site.com/*
  • File downloads: *.pdf, *.zip

Analytics Protection

Prevent analytics tracking during prerender phase:

Supported Analytics Services

  • Google Analytics: Blocks tracking during prerender
  • Google Ads: Prevents conversion tracking
  • Facebook Pixel: Blocks event tracking
  • Microsoft Clarity: Prevents session recording
  • Custom JavaScript: Add custom analytics protection code

Browser Compatibility

  • Chrome/Edge 109+: Full support
  • Firefox: Limited support (prefetch only)
  • Safari: No support (graceful fallback)
  • Automatic detection: Feature detection prevents errors

Performance Benefits

  • Instant navigation: Near-zero loading times for prerendered pages
  • Improved Core Web Vitals: Better LCP and FID scores
  • Enhanced user experience: Seamless browsing experience

Best Practices

  • Start with moderate eagerness and adjust based on analytics
  • Use same-origin restriction for better performance
  • Exclude login, admin, and form submission pages
  • Monitor browser console for speculation rule errors
  • Test on various devices and browsers
What are your feelings