- Service Worker – is essentially act as proxy servers that sit between web applications, and the browser and network (when available). They are intended to (amongst other things) enable the creation of effective offline experiences, intercepting network requests and taking appropriate action based on whether the network is available and updated assets reside on the server. They will also allow access to push notifications and background sync APIs.
| Web Workers | Service Workers | |--------------|--------------|------------------| | Instances | Many per tab | One for all tabs | | Lifespan | Same as tab | Independent | | Intended use | Parallelism | Offline support |
Web Workers are handy to run expensive scripts without causing the user interface to freeze, while Service Workers are useful to modify the response from network requests (for example, when building an offline app).