title: image.onError event never fires, but image isn't valid data - need a work around
body: <p>I am trying to append an image to a page using JavaScript:</p>
  
  <pre><code>image = document.createElement('img');
  image.onload = function(){
      document.body.appendChild(image);
  }
  image.onerror = function(){
      //display error
  }
  image.src = 'http://example.com/image.png';
  </code></pre>
  
  <p>The user must be authenticated to see this image, and if they are not, I want to display an error message. Unfortunately, the server is not returning an HTTP error message, but rather redirect the request to a (mostly) empty page, so I am getting an <code>HTTP 200</code>, but the warning <code>Resource interpreted as Image but transferred with MIME type text/html</code> and nothing is displaying.</p>
  
  <p>How can I handle this case? I don't have the ability to change what the webserver serves up if the user isn't authenticated.</p>