title: <img> onerror with 404 image response
body: <p>I'm loading images from a server which returns images when there is a 404.  That is, if the image I'm loading doesn't exist, the server will return a 404 response with a 200x200 PNG fallback image that says "photo not available" on it.</p>
  
  <p>I would like to detect the times when this happens client-side.  I tried the <code>onerror</code> attribute:</p>
  
  <pre><code>&lt;img src="http://example.com/photo.jpg" onerror="console.log(this)" /&gt;
  </code></pre>
  
  <p>This code only works when the 404 response from the server has no image at all.  Since my 404 response does, the <code>onerror</code> event is never fired.</p>
  
  <p>Is there a way around this problem, short of pre-loading images with JavaScript?</p>