ScriptResourceDefinition.LoadSuccessExpression 属性
定义
获取或设置用于检测 JavaScript 文件是否成功加载的 JavaScript 表达式。Gets or sets a JavaScript expression that is used to detect whether a JavaScript file loaded successfully.
public:
property System::String ^ LoadSuccessExpression { System::String ^ get(); void set(System::String ^ value); };
public string LoadSuccessExpression { get; set; }
member this.LoadSuccessExpression : string with get, set
Public Property LoadSuccessExpression As String
属性值
JavaScript 表达式。The JavaScript expression. 默认值为一个空字符串。The default is an empty string.
注解
此属性与属性结合使用, ScriptManager.EnableCdnFallback 可呈现内联脚本,如果脚本未能从 CDN 加载,则会恢复为从本地服务器位置加载库。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.
对于 Microsoft 的脚本库,此值已设置。For script libraries from Microsoft, this value is already set. 如果要自行注册脚本并获取 CDN 后备支持,请将此属性设置为表达式。If you want to register a script yourself and get CDN fallback support, you would set this property to an expression. 例如,若要测试 jQuery library 是否已加载,可以使用如下所示的表达式:For example, to test whether a jQuery library has been loaded, you can use an expression like the following:
typeof(window.jQuery) !== "undefined"