From 2aa0464277853262ff76571f71d25816ae24c59b Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Wed, 28 Sep 2016 13:06:37 +0100 Subject: [PATCH] Add fallback for event.request.mode --- public/sw.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/sw.js b/public/sw.js index f4803ce..6fed893 100644 --- a/public/sw.js +++ b/public/sw.js @@ -44,7 +44,10 @@ self.addEventListener('fetch', function(event) { } // If we navigate to a page - if(event.request.mode === 'navigate') { + if ( + event.request.mode === 'navigate' || + (event.request.method === 'GET' && event.request.headers.get('accept').includes('text/html')) + ) { event.respondWith( // Make the request