Pinterest rebuilt their mobile web experience as an offline-first Progressive Web App and reported a 60% increase in engagement, a 44% increase in ad revenue, and a 40% increase in time spent on the platform. The core technology behind these improvements was not a redesign or new features — it was service worker precaching.

Service workers allow your website to cache critical resources locally on the user's device. On return visits, the site loads from the local cache before touching the network. The result is instant loading — measured in milliseconds, not seconds — and the ability to browse your site even with no internet connection.

I implemented service worker precaching across all 52 sites in our network using Workbox, Google's open-source service worker library. Return visit load times dropped to under 100ms. Pages per session increased. Bounce rates decreased. And the implementation cost nothing beyond the initial setup time.

Why Offline-First Matters for Content Sites

The typical objection is: "My readers have internet access. Why do they need offline capability?" The answer is that offline-first is not primarily about offline access. It is about speed.

When a service worker serves cached content, it responds in 10-50 milliseconds. A network request to your server takes 200-2000 milliseconds depending on the user's connection, your server location, and network congestion. The difference is not subtle — it is the difference between a page that feels instant and a page that feels like it is loading.

This speed difference affects every downstream metric:

Bounce rate. Google's research shows that as page load time increases from 1 second to 3 seconds, the probability of bounce increases 32%. At 5 seconds, it increases 90%. Cached pages load in under 1 second, keeping bounce rates at their minimum.

Pages per session. When navigation between pages is instant, users explore more. Clicking from one article to another feels like scrolling — there is no loading pause that creates an exit opportunity. Our network saw pages per session increase by approximately 25% after implementing precaching.

Perceived quality. Users perceive fast sites as more professional, more trustworthy, and higher quality. This perception is well-documented in UX research and applies regardless of actual content quality. Speed is a trust signal.

How Precaching Works

Standard browser caching is passive — the browser stores resources it has already downloaded and may or may not serve them on future visits. Cache eviction policies are heuristic and unreliable.

Service worker precaching is active and deterministic. During the service worker installation phase (triggered on the first visit), the service worker proactively downloads and caches a list of resources you specify. On subsequent visits, the service worker intercepts network requests and serves the cached versions.

The precache list typically includes:

For a content site with 30 pages, the total precache payload is typically 2-5 MB — downloaded once, in the background, without blocking the initial page load.

Workbox Implementation

Workbox simplifies service worker development from complex, error-prone manual implementations to clean configuration files.

Installation

npm install workbox-cli --save-dev

Configuration

Create a workbox-config.js file:

module.exports = {
  globDirectory: '_site/',
  globPatterns: [
    '**/*.html',
    '**/*.css',
    '**/*.js',
    'fonts/**/*.woff2',
    'images/logo.svg',
    'images/icons/*.png'
  ],
  globIgnores: [
    'images/blog-*.webp'  // Don't precache large blog hero images
  ],
  swDest: '_site/sw.js',
  runtimeCaching: [
    {
      urlPattern: /images\/blog-.*\.webp$/,
      handler: 'CacheFirst',
      options: {
        cacheName: 'blog-images',
        expiration: {
          maxEntries: 30,
          maxAgeSeconds: 30 * 24 * 60 * 60 // 30 days
        }
      }
    }
  ]
};

This configuration precaches all HTML, CSS, JavaScript, and fonts. Blog hero images are cached on demand using a CacheFirst strategy — they are cached after the first view and served from cache on subsequent views.

Build Integration

Add to your build command:

eleventy && npx workbox generateSW workbox-config.js

Registration

Add the registration script to your HTML:

<script>
  if ('serviceWorker' in navigator) {
    window.addEventListener('load', () => {
      navigator.serviceWorker.register('/sw.js')
        .then(reg => console.log('SW registered'))
        .catch(err => console.error('SW registration failed:', err));
    });
  }
</script>

What Happens on Each Visit

First Visit

  1. Page loads normally from the network
  2. Service worker installs in the background
  3. Precache resources download in the background (no impact on page performance)
  4. User sees a normal page load — no visible difference

Second Visit

  1. Service worker intercepts the page request
  2. Cached HTML is served in under 50ms
  3. All CSS, JavaScript, and fonts load from cache instantly
  4. Blog images load from cache if previously viewed, or from network if new
  5. User experiences near-instant page loading

Offline Visit

  1. Service worker intercepts the page request
  2. Cached HTML is served from cache
  3. All precached resources are available
  4. User can browse all cached pages without internet
  5. A "you're offline" banner can optionally notify the user

Strategic Caching Decisions

Precache Everything vs. Selective Precaching

For small sites (under 50 pages), precaching every HTML page is practical. The total payload stays under 5 MB.

For larger sites, precache selectively:

Use runtime caching for everything else — resources get cached after the first view and served from cache on subsequent views.

Cache Versioning

Workbox handles cache versioning automatically by including content hashes in the precache manifest. When you deploy an update:

  1. Changed files get new hashes
  2. The service worker detects the changes
  3. Only changed files are re-downloaded
  4. Unchanged files remain cached

This means deployments are efficient — a small content update does not re-download the entire precache.

Font Caching

Fonts are excellent candidates for aggressive caching because they rarely change and cause visible layout shifts (FOUT/FOIT) when loading from the network. Precaching fonts eliminates these layout shifts entirely on return visits.

Measuring Results

Core Web Vitals

Use Google Search Console's Core Web Vitals report to track improvements. Key metrics:

Analytics Comparison

Compare metrics for new visitors (first visit, no cache) vs. returning visitors (cached):

Lighthouse Scores

Run Lighthouse audits before and after implementation. The PWA (Progressive Web App) audit section will show significant improvements, and Performance scores will improve for return visits.

Results Across Our Network

After implementing Workbox precaching across all 52 sites:

Implementation time: 45 minutes for the first site (including learning the Workbox configuration). 15 minutes per additional site (shared configuration pattern). Total across 52 sites: approximately 4 hours.

The performance improvement from service worker precaching is one of the largest single optimizations available to content sites. It costs nothing, requires no infrastructure changes, and delivers measurable improvements to every engagement metric.

For the complete performance and marketing strategy, see The Resale Trap and The $100 Dollar Network.


Want the Full Data?

This article draws from The Resale Trap — 395 pages of sourced research covering total cost of ownership, all 50 states ranked, insurance mechanics, and more.

Part of The Trap Series

The W-2 TrapThe $97 LaunchThe Condo TrapThe Resale Trap