Use jquery static resources Public Library CDN and fallback address

Source: Internet
Author: User

Now the internet giants have provided some static resources public library for the vast number of developers to provide convenience;

Because they have CDN nodes all over the place, using these repositories can speed up loading resources and save traffic.

However, because there is a sacred wall of reason, I wait for the people living in the Celestial kingdom is not able to enjoy Google's resource pool;

But Baidu's resource pool is also very good; recommended try: http://cdn.code.baidu.com/

Here's an example of jquery:

<script type= "Text/javascript" src= "//apps.bdimg.com/libs/jquery/2.0.0/jquery.min.js" ></script>< Script> (function () {window.jquery | | document.write (' <script src= '/public/static/js/jquery-2.0.0.min.js ' > <\/script> ');}) ();</script>

But, the world of the Internet is changing so fast, who can guarantee that Baidu will provide us with CDN service permanently?

So be on the safe side; we still need to put a jquery on our server, and then set the fallback address;

When Baidu's CDN is not available, use our own server's jquery resources;

Code as above;

This article for Bai Jun Remote original article, reprinted without contact with me, but please specify from Bai Jun remote blog http://www.baijunyao.com

Use jquery static resources Public Library CDN and fallback address

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.