Reference

Service worker (offline cache)

A service worker is a background script a website installs to serve pages and assets even offline, powering installable web apps (PWAs). It keeps its own cache of files; clearing a site’s data unregisters it and removes that cache, which can free space and disable offline access.

Storage conceptsGeneral

Service worker (offline cache)

Also known as: service worker, PWA cache, offline web cache

A service worker is a background script a website installs to serve pages and assets even offline, powering installable web apps (PWAs). It keeps its own cache of files; clearing a site’s data unregisters it and removes that cache, which can free space and disable offline access.

  • Background script that enables offline web apps
  • Keeps its own cache, separate from the browser cache
  • Cleared with site data; disables offline access

How offline web apps work

A service worker sits between a website and the network. Once installed, it can answer requests from a stored cache instead of the internet, which is what lets a Progressive Web App open and function without a connection. It manages its own Cache Storage, separate from the normal browser cache.

Because a service worker deliberately keeps copies of pages, scripts, and media for offline use, an installed web app can hold a noticeable amount of space — often alongside data in IndexedDB.

Clearing a service worker

Service-worker caches are cleared with site data. In Chrome, use Settings > Privacy and security > Delete browsing data > Cookies and other site data, or unregister it under Site settings for that site. On iOS, clearing Safari or the browser app’s website data removes it.

Clearing it disables offline access until the site reinstalls its worker on your next online visit, and forces assets to re-download — so it frees space at the cost of the offline copy.

Related terms

Keep reading the reference.

Act on it

Guides and tools for this topic.