Merge pull request #7 from Setti7/master

Fix problem of multiple service workers being registered over multiple URLs
This commit is contained in:
Silvio Luis
2019-02-11 07:33:13 -02:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -36,7 +36,7 @@
// Initialize the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js', {
scope: '.'
scope: '/'
}).then(function (registration) {
// Registration was successful
console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);

View File

@@ -53,7 +53,7 @@ class CreateMetaTemplateTagTest(TestCase):
'<script type="text/javascript">',
"if ('serviceWorker' in navigator) {",
"navigator.serviceWorker.register('/serviceworker.js', {",
"scope: '.'",
"scope: '/'",
"}).then(function (registration) {",
"console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);",
"}, function (err) {",