title: If we assume all web browsers understand the <script> defer attribute, is it better just to put the linked script in the head with the defer?
body: <p>If we compare these two options for a webpage and linked JavaScript files:</p>
  
  <ol>
  <li>putting all <code>&lt;script src="..."&gt;</code> near the end of the webpage, versus</li>
  <li>putting them in the <code>&lt;head&gt;</code> section but use <code>&lt;script defer src="..."&gt;</code> </li>
  </ol>
  
  <p>and if <a href="https://www.growingwiththeweb.com/2014/02/async-vs-defer-attributes.html" rel="nofollow noreferrer">the mechanism of how <code>defer</code> works is as described in this page</a>, <a href="https://flaviocopes.com/javascript-async-defer/" rel="nofollow noreferrer">this other page</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script" rel="nofollow noreferrer">on Mozilla</a>, and that <a href="https://caniuse.com/#feat=script-defer" rel="nofollow noreferrer"><code>defer</code> is supported in almost all modern browsers</a>, then isn't it just better to use Option #2 above?</p>
  
  <p>The reason is, Option 1 and 2 would work exactly the same, except for Option #2, the download of the JavaScript file can be parallel with the parsing (and rendering) of the HTML file.  So if the download time is 0.2s or 0.5s, this time could be saved.  This is true for SPA (Single Page Application) or for old fashion webpages if the JS adds elements to the page or kick-starts any dynamic or interactive elements in the page.</p>
  
  <p>The only exception would be, if the browser is smart enough that, before parsing the whole HTML file in Option 1 above, it already "gathers" all JS file URLs and silently download them before the HTML file is parsed to the end or to the point of the <code>&lt;script&gt;</code> tag. But this will make Option 1 and 2 work exactly the same, so Option 2 would still be faster for browsers that doesn't do this?</p>
  
  <p>P.S. having said that, I think there is one catch: since HTTP/1.1 specification recommends browsers should download at most 2 items from the same hostname at a time, so if the JS file is being downloaded and taking up one spot, some image files can be slower to arrive. (if the JS and images come from the same hostname)</p>