Home  >  Article  >  Web Front-end  >  jQuery cdn usage introduction_jquery

jQuery cdn usage introduction_jquery

WBOY
WBOYOriginal
2016-05-16 17:34:183300browse

If you don't want to download and host jQuery, you can also reference it through a CDN (Content Delivery Network).
Baidu, Google and Microsoft all have jQuery on their servers.

jQuery Baidu cdn (definitely choose Baidu or Sina in China)
Loading address:

Uncompressed:

Compression:


Supported versions: 2.0.3, 2.0.2, 2.0.1, 2.0.0, 1.10.2, 1.10.1, 1.10.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8. 1, 1.8.0, 1.7.2, 1.7.1, 1.7.0, 1.6.4, 1.6.3, 1.6.2, 1.6.1, 1.6.0, 1.5.2, 1.5.1, 1.5.0, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.2, 1.3.1, 1.3.0, 1.2.6, 1.2.3

To reference jQuery from Google or Microsoft, use one of the following codes:

Google CDN:

Copy code The code is as follows:






Copy code The code is as follows:

http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js


Try it yourself

Tip: Get the latest available version through Google CDN:

If you observe what's on the Google URL - the jQuery version (1.8.0) is specified in the URL. If you wish to use the latest version of jQuery, you can also remove a number from the end of the version string (such as 1.8 in this example) and Google will return the latest available version in the 1.8 series (1.8.0, 1.8.1, etc.), or It is also possible to leave only the first number, and Google will return the latest available version in the 1 series (from 1.1.0 to 1.10.2).
Microsoft CDN:
Copy code The code is as follows:





Try it yourself

Tip: Using Google or Microsoft’s jQuery, there is a big advantage:

Many users have loaded jQuery from Google or Microsoft when visiting other sites. All the result is that when they visit your site, jQuery is loaded from cache, which reduces load times. At the same time, most CDNs ensure that when a user requests a file from them, a response is returned from the server closest to the user, which can also improve loading speeds.

Several CDN acceleration points for jquery

Google jquery cdn acceleration point
http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js

Microsoft jquery cdn acceleration point
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js

Sina jquery cdn acceleration point

http://lib.sinaapp.com/js/jquery/1.10.2/jquery-1.10.2.min.js

You can also write like this, the first one is preferred. If the loading fails, js will load the second address

Copy code The code is as follows:



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn