8

There are a lot of open source JS libraries available on CDNs. Using the bundle feature of ASP.NET MVC it is possible to define the fallback if a CDN fails.

The CdnFallbackExpression is a useful feature, however, I cannot seem to find any list of the expressions to use for libraries other than jquery. There a few listed in this blog post: http://geekswithblogs.net/cskardon/archive/2014/07/04/cdnfallbackexpression-for-jquery-jquery.ui-modernizr-and-bootstrap.aspx

If I don't know the fallback expression, how can I find it out?

UPDATE:
For anyone else looking, here are the ones I've managed to find so far:

## Library ##      ## Expression ##
jQuery             window.jQuery  
jQuery.UI          window.jQuery.ui  
Modernizr          window.Modernizr  
Bootstrap          $.fn.modal  
jquery.transit     $.transit  
jquery.validate    $.validator  
json2              JSON.stringify  
webfont            WebFont  
jquery.blockUI     $.unblockUI()  
respond            window.respond  
moment             window.moment  

I'm still missing the expressions for
wow.js
uploadify.js
jcrop.js
form.js
TweenMax.js
ScrollToPlugin.js

p u
  • 1,395
  • 1
  • 17
  • 30
MrNova
  • 111
  • 4
  • That looks like it's just an object defined by the loaded script to test for existence? e.g. loading jQuery creates an object called `jQuery` inside the default object which is `window`. I assume that he's testing Bootstrap adds a `modal` function to jQuery, but if he is using that - and if it's the best, I don't know bootstrap, it would be better to test `window.jQuery.fn.modal` in case jQuery is in no-conflict mode without `$` defined. Which other libraries were you thinking of? – Rup May 08 '15 at 12:08
  • angularjs: window.angular – MikeT Mar 17 '16 at 04:46
  • From http://stackoverflow.com/a/5452758/284598, looks like jquery validate unobtrusive can be checked using 'window.jQuery.validator.unobtrusive'. – GaTechThomas Jan 26 '17 at 00:57

0 Answers0