What would be a good way to attempt to load the hosted jQuery at Google (or other Google hosted libs), but load my copy of jQuery if the Google attempt fails?
I\'m n
Using Razor syntax in ASP.NET, this code provides fallback support and works with a virtual root:
@{var jQueryPath = Url.Content("~/Scripts/jquery-1.7.1.min.js");}
Or make a helper (helper overview):
@helper CdnScript(string script, string cdnPath, string test) {
@Html.Raw("" +
"")
}
and use it like this:
@CdnScript("jquery-1.7.1.min.js", "ajax/jQuery", "window.jQuery")
@CdnScript("jquery.validate.min.js", "ajax/jquery.validate/1.9", "jQuery.fn.validate")