4 ms·
I'm still awaiting the day when the Google CDN version of JQuery goes down.
by AznHisoka 15y ago
I'm still awaiting the day when the Google CDN version of JQuery goes down.
- zachallia 15y agodoomsday
- Encryptor 15y agowe frequently experience problems downloading scripts from google's CDN, which is why we switched to using local files.
- simonsarris 15y agoIn case others are wondering, its quite easy to make a "fallback" when using CDN scripts. For instance: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js"></script> <script>window.jQuery || document.write("<script src='js/libs/jquery-1.6.4.min.js'></script>")</script> Could save all such sites that rely on Google CDN jQuery
- nbpoole 15y agoIt happened almost a year ago! http://news.ycombinator.com/item?id=2398095 http://news.ycombinator.com/item?id=2398095
- FlemishBeeCycle 15y agoThat's been one of my concerns, the best way to circumvent that issue is to do something like the following: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script>window.jQuery || document.write(unescape("%3Cscript src='/path/to/jquery.js' type='text/javascript'%3E%3C/script%3E"));</script> This way it will fallback to a local copy if Google's goes down. [Edit: simonsarris replied with something similar as I was replying, however, the advantage of using unescape is that you don't get invalid markup warnings]