title: JavaScript in <head> or just before </body>?
body: <p>I am about to embark on a new web project and I plan to put some JavaScripts in the <code>&lt;head&gt;</code> and also some before <code>&lt;/body&gt;</code>, using the following scheme:</p>
  
  <ol>
  <li><p>Scripts that are essential for the UX of the page: in the <code>&lt;head&gt;</code>. As I've picked up perusing the web - scripts in the <code>&lt;head&gt;</code> is loaded before the page loads, so it would make sense to put scripts that are essential to the user experience there.</p></li>
  <li><p>Scripts that are non-essential to the design and UX (Google Analytics scripts etc.): before the <code>&lt;/body&gt;</code>.</p></li>
  </ol>
  
  <p>Is this a sensible approach?</p>
  
  <p>Another approach would be to put all the scripts in the <code>&lt;head&gt;</code> and add defer attributes to the  non-essential scripts. However, I read that older versions of Firefox don't pick up the defer attribute.</p>