title: JavaScript terminating all scripts running without throwing errors
body: <p>In a company website, I have a page embedding JavaScript in such fashion:</p>
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;...&quot;&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;...&quot;&gt;
    &lt;script src=&quot;...&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;...&quot;&gt;&lt;/script&gt;
    &lt;script&gt;
      ...
    &lt;/script&gt;
  
    &lt;script&gt;
      /*
       * My block
       */
    &lt;/script&gt;
  
    &lt;script&gt;
      ...
    &lt;/script&gt;
    &lt;script src=&quot;...&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;...&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>The page is semi-managed by other teams in the company. The <code>&lt;script&gt;</code>'s before <code>My block</code> are hardcoded to load some of the prerequisite company-wide scripts. One of those scripts is jQuery. I can't change any of them because they are managed by another team. Due to some reasons, those scripts fail to load randomly sometimes. (Response codes can be 400, 404, 500, etc)</p>
  <p>The scripts below <code>My block</code> have dependencies on the scripts above <code>My block</code>. So if the scripts on the top fail to load, the scripts at the bottom will throw out a lot of errors.</p>
  <p>Inside <code>My block</code>, I am hoping to add a check to see if those scripts are loaded and running. (May be to check against jQuery?) If they are not loaded, I want to terminate all the loading/running of the scripts after <code>My block</code>, so the page will display a user-friendly message and doesn't throw a bunch of errors.</p>
  <p>I wonder if this is possible?</p>