title: Service worker image status code
body: <p>I try to detect error 404 of images with a service worker.
  Is there a way to get the status code of an image fetch?</p>
  
  <pre><code>self.addEventListener('fetch', function(event) {
  
      console.log('Handling fetch event for %s', event.request.url);
  
      event.respondWith(
          fetch(event.request).then(function(response) {
  
              if (response.status == 200) {
                  return response;                    
              }
              else {
                  /* return some default image */
              }
  
          })        
      );
  
  });
  </code></pre>
  
  <p>This code works well with html files, but when it fetches an image, the status code is always 0. Is there a way to get status code of the images? I removed the cache and everything else to make my example simple.</p>
  
  <p>This is the sample page I tried to load:</p>
  
  <pre><code>&lt;body&gt;
      &lt;!-- This image is working --&gt;
      &lt;img src="http://www.google.ca/images/srpr/logo11w.png"&gt;
      &lt;!-- This image returns 404 --&gt;
      &lt;img src="http://www.google.ca/images/srpr/00000.png"&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>So the html page itself status is 200 but both of the images return status of 0.</p>