Mobile Number Tracker
Trace Mobile Number Earn Money Online
© TechWelkin.com

Benefits of Loading jQuery from Google

JavaScript is beautiful!
Samyak Lalit | March 22, 2012 (Last update: September 13, 2019)

Samyak Lalit is an Indian author and disability rights activist. He is the principal author and founder of projects like TechWelkin, WeCapable, Viklangta, Kavita Kosh among many others.

jQuery makes life of programmers so much more easier! And it’s fun as well –isn’t it? I guess it is the best JavaScript framework available out there. Nowadays, a massive number of websites use jQuery and there are several methods of loading it into your webpage.

You can direct your browser to get a copy from the jQuery website, from your own server, from some other server where it is hosted –or you can load it from Google API server. The question is what is the best way to load jQuery? Well, obviously, it is the Google way. Here I will tell you why and what are the advantages of loading jQuery from Google API.

But first all, let’s see how to load it. Use the following line in the HEAD section of your webpage to load jQuery from Google:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
JavaScript is beautiful!

You can change the version number depending upon which version you require for your website. I would recommend that you don’t use an automatic latest version of jQuery on your website. jQuery keeps on developing and changing. But the plugins and other codes on your website may require a specific version. So, it is better to use jQuery of a specific version number.

Now let’s talk about advantages of loading jQuery from Google’s server:

  1. Google API servers are distributed. They form a CDN (Content Delivery Network) and deliver content much faster. Browser will be able download the files from the server which is physically closest to the client machine
  2. Most servers force a limit on how many connections a browser can open. So, if jQuery is being loaded from Google –you save one connection to your own server and that can be used by the browser to download other stuff from your server. On busy websites and blogs, this could translate into a big resource saving.
  3. Because countless websites are already using jQuery from Google –there are high chances that the user will already have a copy of jQuery from Google in their local cache! This means that in some cases the browser will not even need to download jQuery files.
  4. If your host is charging you for data transfer (i.e. bandwidth) –then you’ll save money because jQuery’s download from Google is free.

Aren’t these significant benefits of loading jQuery from Google? I guess they are. If Google is hosting something for us for free, why not to use it?!

Please share what you think on this issue. Thank you for using TechWelkin.

© TechWelkin.com

Leave a Reply

Your email address will not be published. Required fields are marked *