This commit is contained in:
Kasper Rynning-Tønnesen
2016-08-03 10:29:19 +02:00
parent 204b067e67
commit 4359144925
4 changed files with 39 additions and 133 deletions

View File

@@ -60,13 +60,17 @@ var connection_options = {
var fromFront = false;
var fromChannel = false;
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistration().then(function(r) {
try {
r.unregister();
} catch(e) {}
});
};
if (navigator.serviceWorker) {
navigator.serviceWorker.register('/service-worker.js', {scope: '/'})
.then(function (registration) {
console.log(registration);
})
.catch(function (e) {
console.error(e);
})
} else {
console.log('Service Worker is not supported in this browser.');
}
$().ready(function(){
if(!fromFront && window.location.pathname != "/") init();