title: my browser registers the service worker and caches the urls but it doesn't work offline?
body: <p>This registers and works perfectly fine online. But when the server is turned off, and when the page is refreshed, the registered serviceworker no longer shows up in the console and no caches in the cache storage. </p>
  
  <pre><code>if ("serviceWorker" in navigator){
  navigator.serviceWorker.register("/sw.js").then(function(registration){
      console.log("service worker reg", registration.scope)
  }).catch(function(error){
          console.log("Error:", error);
      })
  }
  </code></pre>
  
  <p>in sw.js</p>
  
  <pre><code>var CACHE_NAME = 'cache-v1';
  var urlsToCache = [
    '/index.html'
  ];
  
  
  self.addEventListener('install', function(event) {
    event.waitUntil(
      caches.open(CACHE_NAME).then(function(cache) {
         return cache.addAll(urlsToCache);
       })
   );
   //event.waitUntil(self.skipWaiting());
  });
  </code></pre>