CDN to host jQuery

How jquery works jQuery is a JavaScript library that can be used across a wide range of developments. It is free, open source software Dual-licensed under the MIT (Massachusetts Institute of Technology) License and the GNU (GNU's Not UNIX) General Public License . jQuery is not just like any other JS library, it is the most widely used Javascript library in the world, putting priceless pre-written Javascript at the fingertips of programmers worldwide.

jQuery setup

Officially there are two ways of using jQuery:

  1. CDN Based Version - You can include jQuery library into your HTML code directly from Content Delivery Network (CDN).

  2. Local Installation - You can download jQuery library on your local machine and include it in your HTML code.

CDN Based Version

Javascript String length
A CDN (Content Delivery Network or Content Distribution Network) is a network of proxy servers globally distributed throughout multiple geographic locations where end users can access cached content. Several tech giants ( Google , Microsoft etc.) offer copies of jQuery libraries hosted on their CDN. Using a CDN can offers better performance of your jQuery (and website as a whole). In order to load a hosted jQuery library, copy and paste the HTML code for that library (shown below) in your HTML page.

Google CDN

<head> <script src=""></script> </head>

Microsoft CDN

<head> <script src=""></script> </head>
FullSource using Google CDN
<html> <head> <title>jQuery Google CDN Setup</title> <script src=""></script> </script> </head> <body> <h1>jQuery Google CDN Setup</h1> </body> </html>

We recommend that you load jQuery libraries from the CDN via HTTPS, even if your own web-pages only uses HTTP.

CDN for jQuery has many advantages. The major advantage is the loading speed because CDN is made for faster loading. So jQuery library gets downloaded very fast from CDN (Content Delivery Network) , in this case making your web-pages to load faster by a few milliseconds .

Local Installation

There are two versions of jQuery libraries accessible for downloading from websites:

  1. Production version - this is for your live website because it has been minified and compressed.

  2. Development version - this is for testing and development (uncompressed and readable code).
The uncompressed version is preferable during programming or debugging; the compressed version saves bandwidth and boost performance in production level. Both versions can be downloaded from web-site. The jQuery library is a javascript file, and you can reference it directly by adding to your html source file.
<head> <script src="jquery-3.5.1.min.js"></script> </head>
However, it's normally a better idea to hold the file name the same as when you downloaded it from CDN websites, as it contains the jQuery version . Also, most web-sites have a different directories for their JS files so you'll need to use the full-path in this case. FullSource
<html> <head> <title>jQuery Setup</title> <script type = "text/javascript" src = "/jquery/jquery-3.5.1.min.js"> </script> </head> <body> <h1>jQuery Setup</h1> </body> </html>