30 March, 2010 8:03 am

Lazy Javascript Loader

Posted by Richard Wong under Development, Javascript | 0 Comment

I was involved in a project recently with some heavy use of Javascript. We needed to load many javascript files on the page. Because of the site structure and the legacy system, there are potential situations where the same javascript is loaded more than once. To over come that, we needed something that can handle the script loading for us.

After looking at many options, we decided to write our own quick and dirty lazy script loader which will fit our need.

The key features we want from it are:

  • Dynamically creating a script tag to load any scripts we want
  • Handle callbacks
  • Handle duplicate script load
  • Small in size and simple api
  • Framework independent

Continue reading »