Preload your Web App resources for speed. Trust me it works and takes like 2mins to implement. Modern browsers will cache you assets once loaded by the plugin so it’s only really used on initial load (see screenshots below). No more streaking images loading in your web app! The plugin can also be used to preload other things such as scripts, audio, video etc… You can also setup callbacks on individual items. That’s another post, stay tuned!


Setup Steps

  • Include the preload.js plugin
  • Create your loading manifest of images
  • (optional): Display a loading progress meter
  • (optional): Do something in the completed loading callback

Code example with Progress Bar

manifest = [



// Create a preloader. There is no manifest added to it up-front, we will add items on-demand.
preload = new createjs.LoadQueue(true, ""); //change "" to add base path

//show progress
var $mainProgress = $("#mainProgress"),
    $progressBar = $mainProgress.find('.progress');
preload.addEventListener("progress", function()
       console.log('Updating preloading progress...'+Math.round(preload.progress*100)+"%");
       $progressBar.width(preload.progress * $mainProgress.width());

//complete callback
preload.addEventListener("complete", function()
    console.log('ASSETS PRELOADED...');


Initial Page Load.


2nd Page Load (refresh).


Setting up the lugin helper code/examples:

These resources will help you expand if you get stuck.

Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.

No Reader comments

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.