Loading page resources

It is important to avoid blocking a page's rendering when loading the script files in the head section of the HTML document. Scripts should always be loaded at the end of the body section in order to make sure that rendering will not depend on network latency that might occur when fetching the required JavaScript files.

Also, it is important to know that it is best to place inline scripts before CSS stylesheets, as CSS will often prevent the scripts from running until they have finished downloading.

Also, splitting the script file payloads and downloading scripts asynchronously are all techniques that must be thought out when structuring a JavaScript application for performance.

Furthermore, Steve Souders has written ...

Get Mastering The Faster Web with PHP, MySQL, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.