Service Worker là script chạy trong background, tách khỏi web page, không có DOM access.
Có thể intercept network requests (cache strategy), enable offline functionality, background sync, push notifications. Là nền tảng của PWA. Chỉ hoạt động trên HTTPS, có lifecycle riêng (install, activate, fetch).
A Service Worker is a script running in the background, separate from the web page, with no DOM access.
It can intercept network requests (caching strategies), enable offline functionality, background sync, and push notifications. It is the foundation of PWAs. Only works over HTTPS and has its own lifecycle (install, activate, fetch).