Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 620
Alexan Avatar asked Aug 01 '15 01:08

Alexan


1 Answers

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

like image 191
Robbert Draaisma Avatar answered Oct 06 '22 01:10

Robbert Draaisma