title: Website not updating when content changes in Cache-First strategy
body: <p>I am using Cache-first strategy in my progressive web app that i want to support offline browsing. I have noted that offline browsing is working fine but when i update content on the website,it still showing the old stuff.I am not sure what is wrong with my code because i want it to check if there is an update before loading the offline content. I have <strong>manifest.json</strong>, <strong>Service-worker.js</strong>, <strong>Offlinepage.js</strong> and <strong>main.js</strong>. </p>
  
  <p>Here is my <strong>service-worker.js</strong> code that i have used:</p>
  
  <pre><code>      //service worker configuration
        'use strict';
  
        const
          version = '1.0.0',
          CACHE = version + '::PWA',
          offlineURL = '/offline/',
          installFilesEssential = [
           '/',
            '/manifest.json',
            '/theme/pizza/css/style.css',
             '/theme/pizza/css/font-awesome/font-awesome.css',
            '/theme/pizza/javascript/script.js',
            '/theme/pizza/javascript/offlinepage.js',
            '/theme/pizza/logo.png',
            '/theme/pizza/icon.png'
          ].concat(offlineURL),
          installFilesDesirable = [
            '/favicon.ico',
           '/theme/pizza/logo.png',
            '/theme/pizza/icon.png'
          ];
  
        // install static assets
        function installStaticFiles() {
  
          return caches.open(CACHE)
            .then(cache =&gt; {
  
              // cache desirable files
              cache.addAll(installFilesDesirable);
  
              // cache essential files
              return cache.addAll(installFilesEssential);
  
            });
  
        }
        // clear old caches
        function clearOldCaches() {
  
          return caches.keys()
            .then(keylist =&gt; {
  
              return Promise.all(
                keylist
                  .filter(key =&gt; key !== CACHE)
                  .map(key =&gt; caches.delete(key))
              );
  
            });
  
        }
  
        // application installation
        self.addEventListener('install', event =&gt; {
  
          console.log('service worker: install');
  
          // cache core files
          event.waitUntil(
            installStaticFiles()
            .then(() =&gt; self.skipWaiting())
          );
  
        });
  
        // application activated
        self.addEventListener('activate', event =&gt; {
  
          console.log('service worker: activate');
  
          // delete old caches
          event.waitUntil(
            clearOldCaches()
            .then(() =&gt; self.clients.claim())
          );
  
        });
  
        // is image URL?
        let iExt = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp'].map(f =&gt; '.' + f);
        function isImage(url) {
  
          return iExt.reduce((ret, ext) =&gt; ret || url.endsWith(ext), false);
  
        }
  
  
        // return offline asset
        function offlineAsset(url) {
  
          if (isImage(url)) {
  
            // return image
            return new Response(
              '&lt;svg role="img" viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg"&gt;&lt;title&gt;offline&lt;/title&gt;&lt;path d="M0 0h400v300H0z" fill="#eee" /&gt;&lt;text x="200" y="150" text-anchor="middle" dominant-baseline="middle" font-family="sans-serif" font-size="50" fill="#ccc"&gt;offline&lt;/text&gt;&lt;/svg&gt;',
              { headers: {
                'Content-Type': 'image/svg+xml',
                'Cache-Control': 'no-store'
              }}
            );
  
          }
          else {
  
            // return page
            return caches.match(offlineURL);
  
          }
  
        }
  
        // application fetch network data
        self.addEventListener('fetch', event =&gt; {
  
          // abandon non-GET requests
          if (event.request.method !== 'GET') return;
  
          let url = event.request.url;
  
          event.respondWith(
  
            caches.open(CACHE)
              .then(cache =&gt; {
  
                return cache.match(event.request)
                  .then(response =&gt; {
  
                    if (response) {
                      // return cached file
                      console.log('cache fetch: ' + url);
                      return response;
                    }
  
                    // make network request
                    return fetch(event.request)
                      .then(newreq =&gt; {
  
                        console.log('network fetch: ' + url);
                        if (newreq.ok) cache.put(event.request, newreq.clone());
                        return newreq;
  
                      })
                      // app is offline
                      .catch(() =&gt; offlineAsset(url));
  
                  });
  
              })
  
          );
  
        });
  </code></pre>