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