Skip to content
Browser internals·Intermediate·Conceptual·1 min read

What can a service worker access that a regular page script cannot, and what can't it access that a page script can?

Short interview answer

It runs on its own thread separate from any page and persists independently of a page's lifetime, letting it intercept network requests and receive push events even when no tab is open. In exchange, it has no access to the DOM and can't directly read or manipulate a page; communication with pages happens through postMessage or the Clients API.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Service workers, caching, and offline support

Related questions