Translate

jQuery Downloading and CDN

You will learn followings:

  • jQuery Downloading 
  • What is jQuery CDN? 

jQuery Downloading 

Compressed and uncompressed copies of jQuery files are available. Uncompressed files are best used during development or debugging. Compressed files save bandwidth and improve performance in production environments. You can also download sourcemap files to use when debugging with compressed files. Users do not need a map file to run jQuery. Map files only improve the debugger experience for developers.

Use below link to download jQuery, to locally download these files, right-click the link and select "Save as" from the menu and save it on your desired location for your use.

jQuery Downloading links:

For help when upgrading jQuery, please see the upgrade guide most relevant to your version. We also recommend using the jQuery Migrate plugin.

Download the compressed, production jQuery 3.7.1

Download the uncompressed, development jQuery 3.7.1

Download the map file for jQuery 3.7.1

You can also use the slim build, which excludes the ajax and effects modules:

Download the compressed, production jQuery 3.7.1 slim build

Download the uncompressed, development jQuery 3.7.1 slim build

Download the map file for the jQuery 3.7.1 slim build

Using jQuery with a CDN

The following CDNs also host compressed and uncompressed versions of jQuery releases. Starting with jQuery 1.9 they may also host sourcemap files; check the site's documentation. Please note that Beta and release candidates are not hosted by these CDNs

  1. Google CDN
  2. Microsoft CDN
  3. CDNJS CDN
  4. jsDelivr CDN

Downloading jQuery using npm or Yarn

 You can install the latest version of jQuery with the npm CLI command.

npm install jquery

You can use the Yarn CLI command & bower as given below:

yarn add jquery


bower install jquery



What is jQuery CDN? 


A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance.

Which are the popular jQuery CDN?

Below is few popular jQuery CDNs.

  1.  Google.
  2.  jQuery.    
  3.  Microsoft

Advantages of CDN:

  1. Light weighted (minified files) therefore download faster on client side form these side.
  2. Reduced the load on the server.
  3. Most important benefit is it will be cached, if the user has visited any site which is using jQuery framework from any of these CDN.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/x.x.x/jquery.min.js"> </script>

<script type="text/javascript" src="http://code.jquery.com/jquery-x.x.x.min.js"> </script>

<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-x.x.x.min.js"> </script>

Suggestions:

It’s always better to load the Js library from CDN, because of the above   given benefits, if in some case it fails (it will never happen; only very little chances are there) then pick from local folder.

Example is like:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/x.x.x/jquery.min.js">
</script> 
<script type="text/javascript">
if(typeof jQuery == 'undefined') 
{ 
 document.write(unescape("%3Cscript src='Scripts/jquery.x.x.x.min.js' type='text/javascript'%3E%3C/script%3E")); 
} 
</script>


 

No comments:

Post a Comment

Popular Posts