Service Workers are a new technology in modern web browsers. They augment the normal web deployment model and empower applications to deliver reliability and performance on par with natively installed code.
Service Workers have many different capabilities, but the most important is their function as a network proxy. They intercept all outgoing HTTP requests made by the application and can choose how to respond to them. For example, they can query a local cache and deliver a cached response if one is available. Proxying isn't limited to requests made through programmatic APIs (such as fetch
), but includes resources referenced in HTML and even the initial request to index.html
itself. Service Worker-based caching is thus completely programmable, and doesn't rely on server-specified caching headers.
Unlike the other scripts which make up an application (such as the Angular app bundle), the Service Worker is preserved after the user closes the tab. T