Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to fallback twitter-bootstrap cdn to local copy [duplicate]

There are many posts about how to fallback a JQuery CDN to a local copy by checking the existance of the global variable JQuery.

My question is , how to do the same to twitter-bootstrap ? Is there a variable defined in bootstrap so that I can check to make sure the CDN is available ?

BTW, I use netdna.bootstrapcdn.com as my bootstrap CDN

like image 991
John Wang Avatar asked Sep 25 '12 01:09

John Wang


1 Answers

This is what I did and it works fine

<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script> <script>    $.fn.modal || document.write('<script src="Script/bootstrap.min.js">\x3C/script>')</script> 
like image 69
Marcel Avatar answered Oct 01 '22 12:10

Marcel