Have a PWA that works fine with network connection. Added a service worker and it works with no connection IF the PWA had been opened at some point before loss of network connection. So far, so good.
If I force quite the PWA (swipe up on the iPhone) then try the PWA, it is blank and asks for a network connection. Is that normal? Does force quitting an app clear the cached files? Or am I missing something?
Service Worker code:
var cacheName = 'floorwork';
var filesToCache = [
'/',
'/index.html',
'/themes/basicblue.min.css',
'/themes/jquery.mobile.icons.min.css',
'/images/carltonsig.png',
'/images/claw1.jpg',
'/images/GLSeal.jpg',
'/js/jquery-1.11.1.js',
'/js/jquery.mobile-1.4.5.min.js'
];
self.addEventListener('install', function(e) {
e.waitUntil(
caches.open(cacheName).then(function(cache) {
return cache.addAll(filesToCache);
})
);
});
self.addEventListener('fetch', function(e) {
e.respondWith(
caches.match(e.request).then(function(response) {
return response || fetch(e.request);
})
);
});