Glossary

Definition

Service worker

Short definition

A service worker is a JavaScript file the browser runs in the background, separate from the page. It intercepts network requests, caches responses so the site works offline, and receives web-push events so the site can notify the user when it is closed.

Reviewed July 8, 2026

Service workers are one of the three requirements Chromium browsers check before offering the PWA install prompt (the others are HTTPS and a Web App Manifest).

They register once per origin and scope, live longer than any single page, and survive tab close. The browser wakes them for fetch, push and sync events.

Because they run outside the page, service workers cannot touch the DOM. They communicate with pages via postMessage or by mutating the cache the page reads from.