Offline support / service worker 

Tab PWA Offline / Service Worker in the site configuration.

Site configuration tab "PWA Offline / Service Worker"

Service worker and offline fallback page in the site configuration

WitPwamanifestServiceWorkerEnabled
Type
boolean
Default
false

Label Enable service worker / offline support. If enabled, a script that registers the service worker is added to the <head> of every page.

WitPwamanifestOfflinePageUrl
Type
string (link)

Label Offline fallback page. Page shown when a page navigation fails because there is no network connection. If empty, WitPwamanifestStartUrl is used. If WitPwamanifestStartUrl is empty too, / is used.

Behaviour 

  • The script is delivered via typeNum = 836 with the header Service-Worker-Allowed: / and registered with scope: '/'. No route enhancer and no file in the document root are required.
  • Install: the offline fallback page is stored in the cache wit-pwa-offline-v2.
  • Activate: all other caches of the origin are deleted.
  • Page navigation: network first. If the request fails, the cached offline fallback page is returned.
  • Styles, scripts, fonts and images: cache first. Successful responses are stored in the cache when they are requested for the first time. Assets requested before are served from the cache, also offline.
  • Requests other than GET and requests with a scheme other than http/https (for example from browser extensions) are not handled.
  • The scope / covers the whole origin, including the TYPO3 backend under /typo3/. Backend styles, scripts, fonts and images are therefore stored in the cache as well.

Disable the service worker 

Disabling the option only stops the registration on new page loads. A service worker that is already installed in a browser stays active until it is unregistered (for example via the browser developer tools).