Search code examples
jquerysignalrcdnfallback

jquery.signalr CDN fallback


I use jQuery from Google CDN and fallback to local copy:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
    window.jQuery || document.write('<script src="Scripts/jquery-2.1.4.min.js">\x3C/script>')
</script>

But I also want to use CDN for jquery.signalr:

<script src="http://ajax.aspnetcdn.com/ajax/signalr/jquery.signalr-2.2.0.min.js"></script>

But how I can check if I need fallback for jquery.signalr?


Solution

  • The same idea as what you do for jQuery, only instead of checking window.jQuery now check for $.signalR.