How To: Load Scripts Faster on Your Webpage

Load Scripts Faster on Your Webpage

This may be an old trick, but it is still very useful. Head.js proudly proclaims that it is the only script you need in your head. You can use it to parallel load all your scripts. This is much faster than loading them one by one.

Step 1: Download Head.js

It can be found at Save it to the same directory as the html file your working on is saved.

Step 2: Add This Between Your Head Tags!



<script src="head.min.js"></script>

Step 3: Add This Between Your Script Tags.

head.js("file1.js", "file2.js", "file3.js");

Except replace the file names with the names of your js files.

Step 4: So Far It Should Look Like This:

<script src="head.min.js"></script>
head.js("less.js", "jquery.js");

Step 5: Style Sheets

If you are planning to link any external style sheets. Make sure you put it before script src. Otherwise it wont work, I had to learn this the hard way.

Step 6: Enjoy.

You should notice a considerable change in your sites performance. Other guides to speed up your site will be coming soon.

Image from Photobucket

Keep Your Connection Secure Without a Monthly Bill. Get a lifetime subscription to VPN Unlimited for all your devices with a one-time purchase from the new Gadget Hacks Shop, and watch Hulu or Netflix without regional restrictions, increase security when browsing on public networks, and more.

Buy Now (80% off) >

Other worthwhile deals to check out:

Be the First to Comment

Share Your Thoughts

  • Hot
  • Latest