Service Worker Script

Service Worker Generator

Service Worker Documentation

Project: My Web App

Generated Date:

Stale-While-Revalidate
my-app-v1
/offline.html

Generated 'sw.js' Code


// Service Worker Code will appear here...
          

Installation Instructions

  1. Download the file as sw.js.
  2. Place it in your website's root directory.
  3. Register it in your main JavaScript file using:
    navigator.serviceWorker.register('/sw.js');

Caching Strategy

Select how the Service Worker should handle network requests.

Serves content from cache for speed, but updates the cache in the background for next time.

Pre-Caching Assets

Define critical files to cache immediately when the Service Worker installs.

The HTML page shown when the user has no internet connection.
Paths to CSS, JS, Images, or Fonts to pre-cache.

Advanced Settings

Change this when you update your site to force a cache refresh.

Project Configuration


Data Management

Scroll to Top