MediaWiki:Mobile.js: Unterschied zwischen den Versionen

Aus FürthWiki

(register serviceworker)
Markierungen: Mobile Bearbeitung Mobile Web-Bearbeitung
 
KKeine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
if ('serviceWorker' in navigator) {
if ('serviceWorker' in navigator) {
   window.addEventListener('load', function() {
   window.addEventListener('load', function() {
     navigator.serviceWorker.register('./serviceworker.js').then(function(registration) {
     navigator.serviceWorker.register('/wiki/serviceworker.js').then(function(registration) {
       // Registration was successful
       // Registration was successful
       console.log('ServiceWorker registration successful with scope: ', registration.scope);
       console.log('ServiceWorker registration successful with scope: ', registration.scope);

Version vom 11. September 2017, 20:27 Uhr

if ('serviceWorker' in navigator) {
  window.addEventListener('load', function() {
    navigator.serviceWorker.register('/wiki/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);
    });
  });
}