Junior JavaScript

What is a service worker?

A service worker is a background script that runs independently of the web page.

It enables offline caching, push notifications, and background sync.

Example:

navigator.serviceWorker.register('/sw.js');

✅ Used in Progressive Web Apps (PWAs).

More from JavaScript Tutorial

All questions for this course