Merge pull request #7 from Setti7/master
Fix problem of multiple service workers being registered over multiple URLs
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
// Initialize the service worker
|
// Initialize the service worker
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.register('/serviceworker.js', {
|
navigator.serviceWorker.register('/serviceworker.js', {
|
||||||
scope: '.'
|
scope: '/'
|
||||||
}).then(function (registration) {
|
}).then(function (registration) {
|
||||||
// Registration was successful
|
// Registration was successful
|
||||||
console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);
|
console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class CreateMetaTemplateTagTest(TestCase):
|
|||||||
'<script type="text/javascript">',
|
'<script type="text/javascript">',
|
||||||
"if ('serviceWorker' in navigator) {",
|
"if ('serviceWorker' in navigator) {",
|
||||||
"navigator.serviceWorker.register('/serviceworker.js', {",
|
"navigator.serviceWorker.register('/serviceworker.js', {",
|
||||||
"scope: '.'",
|
"scope: '/'",
|
||||||
"}).then(function (registration) {",
|
"}).then(function (registration) {",
|
||||||
"console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);",
|
"console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);",
|
||||||
"}, function (err) {",
|
"}, function (err) {",
|
||||||
|
|||||||
Reference in New Issue
Block a user