Hosted jQuery Script Pros and Cons
"Should we use Google/jQuery Hosted jQuery Script?" is a question that may come to a web developers mind. The answer is not a simple one cos there are many factors that one has to look into. Lets see what are the pros and cons.
1. The biggest advantage would be that the user visiting your website may have already cached the jQuery script since he may have visited sites that uses Google hosted jQuery script, Hence there may be no need to even download the jQuery script file as it may already been cached by the browser.
2. It decreases latency (i.e the response time) as Google servers are distributed and my be located at different geographic locations, the file will be downloaded from the nearest locations.
3. Browsers can handle only a few number of connections for a particular host, hence using Google js library api will add concurrency and may fasten up page load time to some extent.
4. If you site has a very high traffic, using Google Hosted jQuery script may lower your bandwidth issue to some extent.
1. It may so happen that Google services may be blocked in some workspaces or counties (e.g. China) hence the script will not be loaded thus your website may not function as expected. If it is very important that you manage to write a intelligent script that handles such scenarios.
2. If you have a service that works offline (on a local network) it would show down your response time drastically. Always use local copy of jQuery when working offline.
3. Though google services seems to be up 99.999%, but it may so happen that the server goes down.
4. The distributed server may be far from the location where a request was made thus resulting in high latency.
5. Security issue : The service may not be available on https protocol.
6. Privacy issues : They may collect user informations. Please read the Privacy policies & Terms for more details : https://developers.google.com/terms/