I fully understand how browser caching works, which is why I know that making the first request to my website immeasurably faster is not worth betraying my user's privacy and my website's stability. At the very least, everybody using CDN-hosted jQuery should also have a fallback copy.
Would just using another CDN be just as safe?
Re:JQuery SSL Certificates Expire
by UnoriginalGuy on Thursday July 31, 2014 @06:00PM
(#8117263)
No, no particular reasons. It is just the safest fallback. Presumably if a user is even able to run that script (since you yourself are hosting it) the library would also be available (i.e. either both are down or neither).
For example, the OP's link's cache will expire (theoretically) in the year 2079. So if a user visited ANY page that utilises JQuery v1.10.2 they already have it. That is a HUGE win. It is an even huger win for mobile (e.g. for small sites you could cut your network traffic in half, which in turn increases loading speed).
It is also trivial to set it up so the page tries the CDN first and if that fails then grab a local copy e.g.
<script src="//code.jquery.com/jquery-1.10.2.js"></script> <script>window.jQuery || document.write('<script src="lib/jquery-1.10.2.js">\x3C/script>')</script>