简体   繁体   中英

Understanding CDN's

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?

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, eg 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, eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM