title: Service Worker - TypeError: Request failed
body: <p>I used service worker to cache the resource from the other domain. I get this error "TypeError: Request failed             serivce-worker.js:12" I don't know why this error is occurring.</p>
  
  <p><strong>service-worker.js</strong></p>
  
  <p><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>var cacheNames=['v1'];
  var urlsToPrefetch=['file from other domain'];
  
  self.addEventListener('install', function (event) {
      event.waitUntil(
          caches.open(cacheNames).then(function(cache) {
              console.log('Service Worker: Caching Files');
              cache.addAll(urlsToPrefetch.map(function (urlToPrefetch) {
                  console.log(urlToPrefetch);
                  return  new Request(urlToPrefetch, {mode: 'no-cors'});
              })).catch(function(error){
              console.log(error);
              });
          })
      );
  });
  
  self.addEventListener('fetch', function(event) {
      console.log('Service Worker: Fetching');
      event.respondWith(
      caches.match(event.request)
        .then(function(response) {
          // Cache hit - return response
          if (response) {
            return response;
          }
          return fetch(event.request);
        }
      )
    );
  });</code></pre>
  </div>
  </div>
  </p>