keyboard_backspace wifi_off

Offline support

Web apps can register a Service Worker to implement offline support.

A Service Worker is a special kind of Web Worker that serves as a proxy for the web app, allowing it to intercept and control network requests. When a request is made while the web app is offline, the Service Worker can intercept it and serve a response from its cache. This cache typically contains static assets like images, stylesheets, JavaScript etc. but it can also contain full HTML pages. In addition to this, it can also defer requests that are made while the user is offline and retry them later when the network is back.

Demo

Disconnect your device from the internet by switching off your WiFi or put your device in Airplane Mode. Vist any demo in this app and notice how they keep working (with exception of demos that require network access like geolocation for example).

To implement offline support for your web app, you can use this Basic Service Worker that is also used in What PWA Can Do Today.

It also takes care of installing a new version of your web app automatically and as soon as possible.

Documentation

Service Worker API on MDN

Browser support

The Service Worker API is supported in all modern browsers.

What PWA Can Do Today A showcase of what is possible with Progressive Web Apps today