title: Is dynamic script injection in html blocking?
body: <p>In <a href="https://stackoverflow.com/questions/610995/cant-append-script-element">this question</a> it is clearly shown how to programmatically inject a new script in an HTML page.</p>
  
  <p>What I'd like to ask, however, is if such injection is <strong>blocking</strong>, that is, it'll wait for the injected script to be loaded and executed before calling the next line.</p>
  
  <p>For example</p>
  
  <pre><code>function inject(script_url) { ... }
  
  // somewhere in the code
  inject('/path/to/script.js');
  func_in_script(); // &lt;-- will "func_in_script" be defined at this point?
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This is what I found out trying:</p>
  
  <p>If I use native JS like</p>
  
  <pre><code>var script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = url;
  script.async = false; // !!!
  script.defer = false; // !!!
  document.head.appendChild(script);
  </code></pre>
  
  <p>Then the functions in the loaded script are <strong>not</strong> immediately available after the call to <code>appendChild()</code>; however if I use jQuery like:</p>
  
  <pre><code>$('&lt;script/&gt;', {
      type: 'text/javascript',
      src: url,
      async: false,
      defer: false
  }).appendTo('head');
  </code></pre>
  
  <p>It works as I'd like it to.</p>