Bläddra i källkod

fix(pwa) fix loading the service worker

We typically use a base URL for static assets using a CDN so loading the worker
from there won't work since it's a different origin. Using a URL relative to the
origin of the page will make it be loaded from the right place.
master
Saúl Ibarra Corretgé 4 år sedan
förälder
incheckning
d5b2da02c1
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. 2
    2
      index.html

+ 2
- 2
index.html Visa fil

25
 
25
 
26
             if (shouldRegisterWorker) {
26
             if (shouldRegisterWorker) {
27
                 navigator.serviceWorker
27
                 navigator.serviceWorker
28
-                    .register('pwa-worker.js')
28
+                    .register('/pwa-worker.js')
29
                     .then(reg => {
29
                     .then(reg => {
30
                         console.log('Service worker registered.', reg);
30
                         console.log('Service worker registered.', reg);
31
                     })
31
                     })
33
                         console.log(err);
33
                         console.log(err);
34
                     });
34
                     });
35
             }
35
             }
36
-        })
36
+        });
37
     </script>
37
     </script>
38
     <script>
38
     <script>
39
         // IE11 and earlier can be identified via their user agent and be
39
         // IE11 and earlier can be identified via their user agent and be

Laddar…
Avbryt
Spara