title: Javascript non-blocking scripts, why don't simply put all scripts before </body> tag?
body: <p><strong>In order to avoid javascript to block webpage rendering, can't we just put all all our JS files/code to be loaded/executed simply before the closing <code>&lt;/body&gt;</code> tag?</strong></p>
  
  <p>All JS files and code would be downloaded and executed only after the all page has being rendered, so what's the need for tricks like the one suggested in this article about <strong><a href="http://www.nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/" rel="nofollow">non blocking techniques to load JS files</a></strong>. He basically suggests to use code like:</p>
  
  <p><code>document.getElementsByTagName("head")[0].appendChild(script);</code></p>
  
  <p>in order to defer script laod while letting the webpage to be rendered, thus resulting in fast rendering speed of the webpage.</p>
  
  <p>But <strong>without using this type of non-blocking technique (or other similar techniques)</strong>, wouldn't we achieve the same non-blocking result by simply placing all our JS files (to be loaded/executed) before the closing <code>&lt;/body&gt;</code> tag?</p>
  
  <p>I'm even more surprised because the author (in the same article) suggests to put his code before the closing <code>&lt;/body&gt;</code> tag (see the "Script placement" section of the article), so he is basically loading the scripts before the closing <code>&lt;/body&gt;</code> tag anyway. What's the need for his code then?</p>
  
  <p>I'm confused, any help appreciated, thanks!</p>
  
  <hr>
  
  <p>UPDATE</p>
  
  <p>FYI Google Analytics is using similar non-blocking technique to load their tracking code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  ...
  (function() 
  {
     var ga = document.createElement('script');
     ga.type = 'text/javascript';
     ga.async = true;
     ga.src = 'your-script-name-here.js';
     var s = document.getElementsByTagName('script')[0];
     s.parentNode.insertBefore(ga, s); //why do they insert it before the 1st script instead of appending to body/head could be the hint for another question.
  })();
  &lt;/script&gt;
  &lt;/head&gt;
  </code></pre>