title: Make sure my .JS file loads every time before others
body: <p>I have a website where I don't have access to the source but I can manipulate it using Javascript. I have a file called <code>main.js</code> that has been included at the very end of the includes to which I have the access to and I would like to run my custom Javascript code in that file. I have a <code>.JS</code> file with a function called <code>helloWorld()</code> on my server that I would like to load before any <code>$(document).ready()</code> callback fires, because one of the <code>$(document).ready()</code> functions on my website page/pages uses this function.</p>
  
  <p><strong>Custom .JS file</strong>:</p>
  
  <pre><code>function helloWorld()
  {
  alert("Hello World");
  }
  </code></pre>
  
  <p><strong>main.js file on the server (Accessible)</strong>:</p>
  
  <pre><code>//All the JS code that the website uses
  ..
  
  // My custom javascript code that includes my custom .JS file
  $.getScript("helloWorld.js", function()
  {
     // Use anything defined in the loaded script...
  });
  </code></pre>
  
  <p>Now I would like the <code>helloWorld()</code> to be loaded whilst the page is loading and before any <code>$(document).ready()</code> functions fired. I understand that loading this <code>.JS</code> file while the page is loading will possibly slow down the page load. Is there a bullet-proof way of making sure that my custom javascript function will be loaded prior to any <code>$(document).ready()</code>'s? If there is any other way I can achieve this, please do let me know. Looking forward to your suggestions.</p>