Where do you place your
<head> element, you might want to consider whether or not this is the best option for you.
So long as HTTP/1.1 is what your website is accessed via (which it will be a long while),
The worst thing you can do is load multiple scripts in this blocking fashion:
When we throw
<script> tags at the end of the
<body>, we allow for the page to paint and then go and fetch the JS synchronously (this lets the user see and utilize the page, but the scripts still haven’t finished loading).
The first is to simply include the HTML5
Or, if you need to support older browsers, add an event listener to the window’s
load function to dynamically build a script tag and append it to the page (note how I do not use
Why didn’t I use
window.onload = here? When you assign a browser callback trigger a value, it can only have one value! When you add an event listener, you allow the window’s load functionality to have more values in the future.