Sys.Application.queueScriptReference Method
Sequentially queues the scripts to be loaded in the queued order.
Sys.Application.queueScriptReference(scriptUrl);
Arguments
- scriptUrl
The URL for the referenced script.
Return Value
None.
Remarks
Use the queueScriptReference method to queue the scripts to be loaded based on the queued order. When scripts are loaded, they are loaded in parallel with the loading of the page and with the page's binary content. This method is an alternative to loading script by using inline <script> elements in the <asp:ScriptManager> element, which stops the page-loading process until the scripts are downloaded. The queueScriptReference method is invoked after the page markup has been loaded and displayed.
Note
The queueScriptReference method is used during asynchronous postbacks and ordinarily should not be called directly.
Example
The following example uses the queueScriptReference method to load the scripts for two custom controls. It then loads the script for a third control that incorporates the other two. Finally, it creates an instance of the third control on the page.
function pageLoad() {
// Make sure the scripts read in the proper order.
Sys.Application.queueScriptReference("StopWatch.js");
Sys.Application.queueScriptReference("StatusBar.js");
Sys.Application.queueScriptReference("DownloadTracker.js");
// Add custom controls to the application.
$create(Demo.DownloadTracker, null, null, null, $get('div1'));
}