Service worker generator: offline support in one file

Choose strategies, get a tested sw.js and the code to register it.

Runs entirely in your browser. Nothing you enter is uploaded.

App shell (precached)
Strategies
Options

sw.js

Register it in your pages

How to use it

  1. List the files your app needs to start (the app shell), one per line.
  2. Choose a strategy for each type of request. Not sure? Read caching strategies or use the strategy picker.
  3. Set the offline page and cache limits.
  4. Copy sw.js to the root of your site, and add the registration snippet to your pages.
  5. Change the version string whenever you deploy, so browsers pick up the new worker.

The generated worker uses plain JavaScript with no libraries, handles navigation preload, cleans old caches, never touches non-GET requests, and waits for your page to confirm before activating an update. For large apps with hashed build files, consider Workbox or Serwist.