Web platform

Service worker

A service worker is an event-driven script that can intercept requests within its scope and support offline behavior. It is separate from a page worker.

Ask the Web platform assistant 1 min read · Updated September 9, 2026

What it is

A service worker is an event-driven script that can intercept requests within its scope and support offline behavior. It is separate from a page worker.

Why it matters

It can serve cached assets when the network is unavailable, but its process may stop between events.

Example

A previously visited lesson can load from Cache Storage while offline; an unvisited lesson may still be unavailable.

Technical detail

Service workers normally require a secure context; localhost is a development exception. Extend asynchronous event work with event.waitUntil.

When to use it

Design installation, activation, updates, and offline failure pages together so a cached shell does not promise missing content.

Go deeper

Sources

More in Web platform

Assembled from the ReLU.chat curated knowledge base. These explanations are concise on purpose; check the sources for anything important.