Home / AJAX

Ajax Script Loader

Modified on 2010/04/08 16:20 by Stephen Walther Categorized as Uncategorized
Ajax applications can require a variety of scripts to be loaded in order for an application to run properly.  Some scripts may have dependencies on other scripts and ensuring that everything is loaded as fast as possible and in the proper order can be challenging.  Although the traditional <script> element can be used to retrieve scripts, this technique slows down the application's initial load time in most browsers since each script is loaded in serial as opposed to in parallel.  Although several workarounds exist, The ASP.NET Ajax Library provides a Script Loader component that can be used to retrieve scripts in a parallel manner resulting in faster page load times while requiring minimal code.

Key features of the Script Loader include:
The ScriptLoader is located in a file named Start.js and capable of loading ASP.NET Ajax Library scripts (see the Figure 1 below), jQuery scripts and jQuery Validation scripts out-of-the-box.  It can also be used to load custom scripts and any dependencies they may have.  Start.js can be retrieved from the Microsoft Content Delivery Network (CDN) or from a local folder containing ASP.NET Ajax Library scripts.


Figure 1. ASP.NET Ajax Library scripts supported by the Microsoft Ajax CDN and the Script Loader.