ScriptResourceDefinition.LoadSuccessExpression Property

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets a JavaScript expression that is used to detect whether a JavaScript file loaded successfully.

Namespace:   System.Web.UI
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public string LoadSuccessExpression { get; set; }

Property Value

Type: System.String

The JavaScript expression. The default is an empty string.

This property is used in conjunction with the ScriptManager.EnableCdnFallback property to render inline script that will revert to loading the library from a local server location if the script fails to load from the CDN.

For script libraries from Microsoft, this value is already set. If you want to register a script yourself and get CDN fallback support, you would set this property to an expression. For example, to test whether a jQuery library has been loaded, you can use an expression like the following:

typeof(window.jQuery) !== "undefined"

.NET Framework
Available since 4.5
Return to top