Disable service worker on Cordova and NW.js platforms

master
Skylar Ittner 4 years ago
parent 664d54ae97
commit 08d7ff224d

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

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

Loading…
Cancel
Save