title: Loading Javascript Dynamically and how to check if the script exists
body: <p>I am using the following technique to load up Javascript dynamically:</p>
  
  <pre><code>var script = document.createElement("script");
  script.type = "text/javascript";
  script.src = "file.js";
  document.body.appendChild(script);
  </code></pre>
  
  <p>It's quite a common approach. 
  It's also discussed here: <a href="http://www.nczonline.net/blog/2009/06/23/loading-javascript-without-blocking/" rel="noreferrer">http://www.nczonline.net/blog/2009/06/23/loading-javascript-without-blocking/</a></p>
  
  <p>I know how to get notified once the file has been loaded and executed</p>
  
  <p>What I don't know is that if the link to the Javascript source file is broken how can I be notified. </p>
  
  <p>Thanks</p>