title: DOMException: Failed to register a ServiceWorker: The script does not have a MIME type
body: <p>It is my first time to use service worker. I got an error "The script does not have a MIME type.". Can anyone help with this issue?</p>
  
  <blockquote>
    <p>The script does not have a MIME type.</p>
    
    <p>Failed to load resource: net::ERR_INSECURE_RESPONSE</p>
    
    <p>Service worker registration failed: DOMException: Failed to register a ServiceWorker: The script does not have a MIME type.
    register.js:6</p>
  </blockquote>
  
  <p><strong>register.js</strong>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// Make sure sw are supported
  if ('serviceWorker' in navigator) {
      navigator.serviceWorker.register('sw_cached_page.js').then(function(registration) {
          console.log('Service Worker: Registered (Pages)');
      },function(error){
          console.log('Service worker registration failed:', error);
      });
  }else{
      console.log('Service workers are not supported.');
  }</code></pre>
  </div>
  </div>
  </p>