0

I've been downloading jquery with:

<script src="//code.jquery.com/jquery-1.10.2.js"></script>

and for some reason, the link went bad. Not a problem as I changed the link to use Microsoft's hosted CDN. I'm wondering though if I should just download the files so to prevent this problem happening again in the future. Is there any reason not to?

DCR
  • 14,737
  • 12
  • 52
  • 115
  • Link works fine. If you're accessing it locally then you'll need to include http: or https: – Wim Mertens Dec 08 '16 at 23:22
  • The CDN was having issues earlier. It has since been restored. – Taplar Dec 08 '16 at 23:46
  • If anyone downvotes this question please be so kind as to explain your thinking and add to the knowledge pool. – Vanquished Wombat Dec 09 '16 at 08:30
  • is it possible to conditionally execute a script based on whether another script ran? Seems like we could try to download jquery from more then one CDN that way – DCR Dec 09 '16 at 17:57
  • Check this similar question: http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go – user2314737 Dec 19 '16 at 09:27

1 Answers1

2

Ultimately if you download the files to your own server then you will not experience the same issue again. But there are other considerations:

Plus points for CDNs

  1. may be faster network and worldwide mirrors so potentially better user experience / performance for your site users;
  2. if you link to the latest version, e.g. library-latest-min.js then you do not have to alter your source code to get latest bug-fixed version of library (see negative below).

Negative points

  1. If the CDN goes offline your site breaks.
  2. If the CDN has a network slowdown your users suffer.
  3. If you link to the latest version, e.g. library-latest-min.js then you do not have to alter your source code to get latest big-fixed version of library but if 'latest' holds any breaking changes then your site breaks.
j08691
  • 204,283
  • 31
  • 260
  • 272
Vanquished Wombat
  • 9,075
  • 5
  • 28
  • 67