Comparison
Cache StoragevsService worker
Cache Storage
you stored whole request and response pairs so the service worker could answer them without the network.
A store of Request-Response pairs, separate from the HTTP cache and controlled entirely by your code. It is what makes offline-first possible, and it obeys no HTTP caching semantics on your behalf: nothing expires unless you delete it. Cache names are the versioning mechanism, so an update means writing a new one and cleaning up the old one on activation.
Full entry →Service worker
a script you are not running sits between the page and the network and answers requests itself.
A worker registered against a scope that intercepts network requests for pages under it, enabling offline support, custom caching and push. It has no DOM access, runs on its own lifecycle, and keeps controlling pages until every tab is closed — which is why a bad one is genuinely hard to remove from the field. Shipping one means owning an update strategy before the first release, not after.
Full entry →