diff --git a/static/js/sw.js b/static/js/sw.js index 12194d3..f258902 100755 --- a/static/js/sw.js +++ b/static/js/sw.js @@ -7,13 +7,16 @@ self.addEventListener('install', function(event) { var preLoad = function(){ console.log('[PWA Builder] Install Event processing'); - return caches.open('pwabuilder-offline').then(function(cache) { + return caches.open('offline').then(function(cache) { console.log('[PWA Builder] Cached index and offline page during Install'); return cache.addAll(['/blog/', '/blog', '/', '/contact', '/resume']); }); }; self.addEventListener('fetch', function(event) { + if (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') { + return; + } console.log('[PWA Builder] The service worker is serving the asset.'); event.respondWith(checkResponse(event.request).catch(function() { return returnFromCache(event.request); @@ -34,16 +37,16 @@ var checkResponse = function(request){ }; var addToCache = function(request){ - return caches.open('pwabuilder-offline').then(function (cache) { + return caches.open('offline').then(function (cache) { return fetch(request).then(function (response) { - console.log('[PWA Builder] add page to offline'+response.url); + console.log('[PWA Builder] add page to offline: ' + response.url); return cache.put(request, response); }); }); }; var returnFromCache = function(request){ - return caches.open('pwabuilder-offline').then(function (cache) { + return caches.open('offline').then(function (cache) { return cache.match(request).then(function (matching) { if(!matching || matching.status == 404) { return cache.match('offline.html'); diff --git a/static/manifest.json b/static/manifest.json index f529a86..3d11b2e 100644 --- a/static/manifest.json +++ b/static/manifest.json @@ -5,7 +5,7 @@ "background_color": "#fa99ca", "display": "standalone", "scope": "/", - "start_url": "https://christine.website/", + "start_url": "/", "description": "Blog and Resume for Christine Dodrill", "orientation": "any", "icons": [ @@ -52,6 +52,6 @@ { "src": "/static/favicon/android-launchericon-512-512.png", "sizes": "512x512" - }, + } ] }