Possible duplicate of:
should-i-link-to-google-apis-cloud-for-js-libraries
also many other discussions, including:
Where do you incl
China has 500 million internet users and is not the only country that blocks google apis, this makes any website that uses http://www.google.com/jsapi dysfunctional. There is a small upside: due to the asynchronous load technique, these sites don´t display the same hang waiting to load as other sites that use the direct reference as eg:
this file is after compression is 24KB, Addition of such file will increase HTTP requests and waiting for the response and execution and parse time that browser will take... if you say the file itself is cached everywhere, even if the file is cached in the browser, don't forget to consider the time it takes to read from disk, execute and parse...
all of this for only getting the jQuery file or other common JS, I think referring directly to the requested resource is better
check Google's best practices for more info.
As others have pointed out answering similar questions, there's a downside. In some countries (such as Iran), these are apparently blocked, breaking the website.
The benefit is it's hosted on googles super low latency and fast servers. you can also just use
<script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js”></script>
its the same effect.
Yes, definitely. Google encourages it. Everyone benefits. It's more likely to be in their cache, and it's one less file that you have to serve.
keep in mind that google jsapi loads the scripts only after the document itself is loaded.
So, if (for example) you are using jquery's $(document).ready()
in your web app, you'll have to switch to google.setOnLoadCallback()
.