title: How to detect on-page 404 errors using JavaScript?
body: <p>I have an HTML page where several JavaScript, CSS and images files are referenced. These references are dynamically injected and user can manually copy the HTML page and the support files to another machine.</p>
  
  <p>If some JS or CSS are missing, the browser complains in the console. For example:</p>
  
  <blockquote>
    <p>Error GET file:///E:/SSC_Temp/html_005/temp/Support/jquery.js</p>
  </blockquote>
  
  <p>I need somehow these errors reported back to me on the inline JavaScript of the HTML page so I can ask user to first verify that support files are copied correctly.</p>
  
  <p>There's the <code>window.onerror</code> event which just inform me that there's a JS error on the page such as an Unexpected Syntax error, but this doesn't fire in the event of a <em>404 Not Found</em> error.  I want to check for this condition in case of any resource type, including CSS, JS, and images.</p>
  
  <p>I do not like to use jQuery AJAX to verify that file physically exists - the I/O overhead is expensive for every page load. </p>
  
  <p>The error report has to contain the <strong>name of the file</strong> missing so I can check if the file is core or optional.</p>
  
  <p>Any Ideas?</p>