title: How to properly register a basic progressive web app service worker?
body: <p>I am trying to register a service worker on my web app, I added on the bottom of my page this script:  </p>
  
  <pre><code>&lt;script&gt;
  // this part is the service worker:
       if('serviceWorker' in navigator){
          // Register service worker
          console.log('Service Worker is supported');
          navigator.serviceWorkerContainer.register('service-worker.js').then(function(reg){
          console.log("Service Worker registration succeeded. Scope is "+reg.scope);
          }).catch(function(err){
              console.error("Service Worker registration failed with error "+err);
          });
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>and on my server on the same folder I created a file service-worker.js:</p>
  
  <pre><code>console.log('Started', self);
  self.addEventListener('install', function(event) {
    self.skipWaiting();
    console.log('Installed', event);
  });
  self.addEventListener('activate', function(event) {
  console.log('Activated', event);
  });
  self.addEventListener('push', function(event) {
    console.log('Push message received', event);
  });          
  </code></pre>
  
  <p>When I inspect it on chrome developer application I click on Service Workers, and nothing shows up.</p>
  
  <p>When I run lighthouse report it gives me an error on Registers a Service Worker.</p>
  
  <p>I am looking for a simple setup to have the download button for my progressive web app, that is actually only a simple web page with a few images and a couple of iframes.</p>
  
  <p>What am I missing? </p>