title: PWA - service-worker JS in subdirectory
body: <p>I tried to have my sw.js file in a subdirectory instead of the root directory. But then I get an error that says the service-worker could not be installed.</p>
  
  <p>Is it really necessary to have this file in the root-directory or am I just missing something?</p>
  
  <p>JS-Code:</p>
  
  <pre><code>if ('serviceWorker' in navigator) {
  
      navigator.serviceWorker.register('/js/pwa/sw.js', { scope: '/js/pwa' }).then(function(reg) {
          console.log('Successfully registered. Scope is ' + reg.scope);
      }).catch(function(error) {
          console.log('Registering failed ' + error);
      });
  } else {
      console.log('Service worker can not be registered on this device');
  }
  </code></pre>