This commit is contained in:
Scott Vitale
2018-01-31 21:30:39 -07:00
parent 23232661e0
commit 4a86f1b974

View File

@@ -14,14 +14,14 @@
<script type="text/javascript"> <script type="text/javascript">
// Initialize the service worker // Initialize the service worker
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
window.addEventListener('load', function () { navigator.serviceWorker.register('/serviceworker.js', {
navigator.serviceWorker.register('/serviceworker.js').then(function (registration) { scope: '.' // <--- THIS BIT IS REQUIRED
// Registration was successful }).then(function (registration) {
console.log('django-progressive-web-app: ServiceWorker registration successful with scope: ', registration.scope); // Registration was successful
}).catch(function (err) { console.log('django-progressive-web-app: ServiceWorker registration successful with scope: ', registration.scope);
// registration failed :( }, function (err) {
console.log('django-progressive-web-app: ServiceWorker registration failed: ', err); // registration failed :(
}); console.log('django-progressive-web-app: ServiceWorker registration failed: ', err);
}); });
} }
</script> </script>