, , , , ,

Here are the following reasons on behalf of Why we should use Google/jQuery  CDN to load JS/CSS library files

  1. It increases the chance of cache-hit.
    As now a days maximum sites are following this practice which implies more users already have the file ready in their browser cache. This way cache hit will increase and server call will decrease.
  2. It increases the parallelism.
    To avoid the unnecessary load from your server all browsers built on a concept so maximum number of concurrent connection to a particular server is fixed and this count is different for different browser. So loading library files from different server will increase the parallelism and it is also intelligent job.
  3. It ensures that the minimum size file will load.
    Google/jQuery CDN ensures that these files are pre-compress in a wide array of formats (like GZIP or DEFLATE) which ensures the time-to-download the file very small.
  4. It reduces the amount of bandwidth used by your own server.
    If your site loading files from Google/jQuery CDN it means you are using their server bandwidth which is free of cost.
  5. It ensures minimum time will be taken to load files.
    Google/jQuery has servers all over the world which ensures that the requested file(s) will load from the nearest CDN server.
  6. They will always keep your JS/CSS library up to date
    Google/jQuery server will up to date JS/CSS library files regularly to their latest stable version so you will be always up to date.

Working Example:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  $(document).ready(function() {
    // Do you JOB

Now I am sure that you are curious to know why I am not using http: and start with //
The reason is this trick will allow you to use a single reference that works on both HTTP and HTTPS page. So depending upon your page url jQuery file protocol will be http or https

KEEP SMILING 🙂 and don’t forget to add comment below.