By Sam Deering

Reduce Your jQuery Script Loading Times

By Sam Deering
Help us help you! You'll get a... FREE 6-Month Subscription to SitePoint Premium Plus you'll go in the draw to WIN a new Macbook SitePoint 2017 Survey Yes, let's Do this It only takes 5 min


Hi guys, I’ve stumbled upon a jQuery script that reduces the loading time of your JavaScript include files. It works by loading all your dot js files at the same time inside an array. I’ve tried the tests out and it does seem to load much quicker than loading your files in the standard way. See the proof below and try it for yourself!

The Standard Way



The head.js Way


Document Ready with head.js

Usually with jQuery code you need to wait until the DOM is ready. This is the same when using head.js and this is how you can acheive the same result.

//same as document.ready() function
head.ready(function() {
     //code to be executed once .js files have loaded.


Login or Create Account to Comment
Login Create Account
Get the most important and interesting stories in tech. Straight to your inbox, daily.Is it good?