🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Web Development Advanced

What is Service Worker?

A JavaScript file that runs in the background, enabling offline support, push notifications, and background sync for web apps.

Service workers act as programmable network proxies between the browser and server. They intercept network requests, cache resources, and serve cached content when offline. This enables Progressive Web App (PWA) capabilities.

The lifecycle includes registration, installation (cache assets), and activation (clean old caches). The fetch event handler implements caching strategies: cache-first, network-first, stale-while-revalidate. Service workers also enable push notifications and background sync.

Related Terms

Webhook
A mechanism where a server sends real-time HTTP POST notifications to a specified URL when specific events occur.
Caching
Storing copies of frequently accessed data in faster storage to reduce load times and server processing.
TypeScript
A typed superset of JavaScript that adds static type checking, interfaces, and advanced IDE support to JavaScript development.
CORS Preflight
An automatic OPTIONS request sent by browsers before certain cross-origin requests to check if the actual request is permitted.
HTTP/2
The second major version of HTTP that improves performance through multiplexing, header compression, and server push.
Server-Sent Events (SSE)
A web technology enabling servers to push real-time updates to browsers over a single HTTP connection, simpler than WebSockets.
View All Web Development Terms →