title: Preload JS, but don't run it
body: <p>I want to preload a large JS file after a page has loaded, so that when I link to that JS file on the required page it is already downloaded and cached.</p>
  
  <p>I'm basically doing this at the moment, and it works, but of course it's not the right way:</p>
  
  <pre><code>preload_js = new Image();
  preload_js = "http://domain.com/files/file.js";
  </code></pre>
  
  <p>This seems such a quick and simple method, no Ajax needed etc. and it works great.</p>
  
  <p>What's the proper way to do this? Surely not with Ajax as that seems overkill for this.</p>
  
  <p>I know there's lots of methods for loading JS but they all seem to actually run the code after the script has loaded, which I don't want.</p>
  
  <p>I don't want to use jQuery (or any library), it must be plain JS. Thanks for any help.</p>