Attempt to fix page load issues on staging server

This commit is contained in:
Josef Citrine 2016-06-13 13:32:49 +01:00
parent 0c1a283867
commit 64d28f0b1f

View file

@ -56,15 +56,19 @@ self.addEventListener('activate', function (event) {
// Basic offline mode
// Just respond with an offline error page for now
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request);
}).catch(function () {
if (event.request.mode == 'navigate') {
return caches.match('/offline.html');
}
})
)
if (event.request.url.indexOf('stage.pony.fm') > -1) {
event.respondWith(fetch(event.request));
} else {
event.respondWith(
caches.match(event.request).then(function (response) {
return response || fetch(event.request);
}).catch(function () {
if (event.request.mode == 'navigate') {
return caches.match('/offline.html');
}
})
)
}
});
self.addEventListener('push', function(event) {