MediaWiki:Mobile.js: Unterschied zwischen den Versionen

Aus FürthWiki

(register serviceworker)
Markierungen: Mobile Bearbeitung Mobile Web-Bearbeitung
(kein Unterschied)

Version vom 11. September 2017, 16:34 Uhr

if ('serviceWorker' in navigator) {
  window.addEventListener('load', function() {
    navigator.serviceWorker.register('./serviceworker.js').then(function(registration) {
      // Registration was successful
      console.log('ServiceWorker registration successful with scope: ', registration.scope);
    }, function(err) {
      // registration failed :(
      console.log('ServiceWorker registration failed: ', err);
    });
  });
}