Disable service worker on Cordova and NW.js platforms

Skylar Ittner 4 years ago
parent 664d54ae97
commit 08d7ff224d

@ -66,15 +66,17 @@
<script src="assets/js/main.js"></script>
<script>
if ('serviceWorker' in navigator) {
// Register a service worker hosted at the root of the
// site using the default scope.
navigator.serviceWorker.register('sw.js').then(function (registration) {
console.log('Service worker registration succeeded:', registration);
}, /*catch*/ function (error) {
console.log('Service worker registration failed:', error);
});
} else {
console.log('Service workers are not supported.');
if (platform_type != "cordova" && platform_type != "nw") {
if ('serviceWorker' in navigator) {
// Register a service worker hosted at the root of the
// site using the default scope.
navigator.serviceWorker.register('sw.js').then(function (registration) {
console.log('Service worker registration succeeded:', registration);
}, /*catch*/ function (error) {
console.log('Service worker registration failed:', error);
});
} else {
console.log('Service workers are not supported.');
}
}
</script>

@ -40,9 +40,6 @@
],
"scope": "/",
"lang": "en-US",
"serviceworker": {
"src": "./sw.js"
},
"categories": ["navigation", "productivity", "utilities", "weather"],
"prefer_related_applications": true,
"related_applications": [

Loading…
Cancel
Save