Browser internals·Advanced·Conceptual·1 min read
Why doesn't a newly activated service worker automatically take over pages that are already open?
Short interview answer
By default, a page stays controlled by whichever worker was controlling it when it loaded, so a page's already-loaded resources aren't suddenly served by different code mid-session; a new worker only starts controlling existing pages after they're fully closed and reopened, unless it explicitly calls clients.claim(), often paired with skipWaiting() in install, to take over immediately.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.