Поделиться через


Sys.Application.notifyScriptLoaded Method

Called by a referenced script to indicate that it has been loaded. This API is obsolete. You no longer need to call this method in order to notify the Microsoft Ajax Library that the JavaScript file has been loaded.

Sys.Application.notifyScriptLoaded();

Return Value

None.

Remarks

Call the notifyScriptLoaded method in all file-based scripts (.js files) to indicate to the ScriptManager object that a referenced script has finished loading.

Note

This API is obsolete. You no longer need to call this method in order to notify the Microsoft Ajax Library that the JavaScript file has been loaded.

The script manager injects script elements into the DOM sequentially, waiting for each script to finish loading before it proceeds to the next one. You can include a call to the notifyScriptLoaded method in each file-based script for pages that perform an asynchronous postback, however it is no longer required. A call to the notifyScriptLoaded method provides notification in all browser types that the script has finished loading.

When calling the notifyScriptLoaded method, it is good practice to check for the presence of the Microsoft Ajax Library to prevent errors if the library is unavailable. The following example shows how to check for the library.

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded(); 

Do not call the notifyScriptLoaded method from scripts that are embedded in assemblies. The script resource handler adds an instance of this call, and a second call will cause an error. If you must embed a file that calls notifyScriptLoaded in an assembly, you can prevent an error by setting the NotifyScriptLoaded property of the ScriptReference object that points to the script to false. (The default is true.)

See Also

Reference

Sys.Application Class

Other Resources

Language Reference