However, when users begin seeing a lot of messages about sites they may not know about, many users throw up their hands and don’t allow these external sites access to the page. Consequently, your application fails because it lacks access to the libraries it needs to work. The answer is to use a single source to access the libraries you need.
The Google Content Distribution Network (CDN) is a series of libraries that you can use to create better applications. Google maintains all of these libraries on a common domain, which means that users don’t have to think so hard about each library you use in an application.
All the user needs to do is approve use of a single domain. Many developers rely on the Google APIs site to gain access to libraries such as jQuery. You see it all the time when working with pages online.
When you want to use a particular library, you click its link on the page, and Google displays a script for accessing it. For example, when you want to use jQuery, you click its link to see a snippet similar to the one shown here.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"> </script>
With a simple replacement of the src attribute, you can use the Google CDN version of the library. Give it a try and you find that the example works just as it did before. It doesn’t matter which version of the library link you use, but the 1.8.3 version of jQuery is the most current version available as of this writing.
Your application may depend on a specific version of the jQuery library. If this is the case, you can access the version you want from the Google CDN. Simply replace the 1.8.3 part of the URL with the version you want. The Google CDN hosts all versions of jQuery except versions 1.2.4 and 1.2.5 because these two versions weren’t available for very long.