Esta página aún no está disponible en Español, así que estás leyendo la versión en inglés.

Service worker generator: offline support in one file

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

Funciona por completo en tu navegador. No se sube nada de lo que escribes.

App shell (precached)
Strategies
Opciones

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.