If you see this, you are online
if ('serviceWorker' in navigator) { navigator.serviceWorker.register('service-worker.js', './'); } index.htmlOh, dear.
’, ); }) ); service-worker.js (detail)Oh, dear.
', { headers: { 'Content-Type': 'text/html' } }); }) );Oh, dear.
', { headers: { 'Content-Type': 'text/html' } }); }) ); } }); service-worker.jsOh, dear.
', { headers: { 'Content-Type': 'text/html' } }); }) ); } });If you see this, you are online
if ('serviceWorker' in navigator) { navigator.serviceWorker.register('service-worker.js', './'); }Oh, dear.
', { headers: { 'Content-Type': 'text/html' } }); }) ); } }); service-worker.js Let’s not do this…If you see this, you are offline
offline.html instead, let’s use a real HTML pageIf you see this, you are offline
offline.html Gotta stash the offline page first!Oh, dear.
', { headers: { 'Content-Type': 'text/html' } }); }) ); } }); service-worker.js (fetch event handler detail) instead of…