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.
This commit is contained in:
Saúl Ibarra Corretgé 2020-10-21 09:33:25 +02:00 committed by Saúl Ibarra Corretgé
parent fbfaed07b2
commit d5b2da02c1
1 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@
if (shouldRegisterWorker) { if (shouldRegisterWorker) {
navigator.serviceWorker navigator.serviceWorker
.register('pwa-worker.js') .register('/pwa-worker.js')
.then(reg => { .then(reg => {
console.log('Service worker registered.', reg); console.log('Service worker registered.', reg);
}) })
@ -33,7 +33,7 @@
console.log(err); console.log(err);
}); });
} }
}) });
</script> </script>
<script> <script>
// IE11 and earlier can be identified via their user agent and be // IE11 and earlier can be identified via their user agent and be