The Google Libraries API is a content distribution network and loading architecture for the most popular, open-source JavaScript libraries. Using the google.load() method gives your application high speed and global access to a growing list of the most popular, open-source JavaScript libraries. You can also use <script> tags to include the libraries.
|
This documentation is designed for people familiar with JavaScript programming and object-oriented programming concepts. There are many JavaScript tutorials available on the Web.
The Libraries API provides your applications with stable, reliable, high-speed, globally available access to all of the most popular, open-source JavaScript libraries. Your application can use our very flexible loader google.load() or direct, path-based access to the scripts.
To begin using the Libraries API, include the following script in the header of your web page.
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
Next, you load the libraries. The preferred method is to load the libraries via standard <script> tags (as in <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>, which will result in the fastest loads.
You can also load any number of libraries via google.load() as follows:
google.load("chrome-frame", "");
google.load("dojo", "");
google.load("ext-core", "");
google.load("jquery", "");
google.load("jqueryui", "");
google.load("mootools", "");
google.load("prototype", "");
google.load("scriptaculous", "");
google.load("swfobject", "");
google.load("webfont", "");
As you can see in the code snippets above, the first argument to google.load is the name of a library. The second argument is a version specification. The complete list of libraries is a growing collection of the most popular, open-source JavaScript libraries.
Note: If you choose to load libraries with google.load, you also need to set google.setOnLoadCallback.
You can find out more about google.load in the Google Loader developer's guide.
google.load gives you two ways to specify which version of the library you wish to load. You can request:
google.load("jqueryui", "1.8.2");, which loads that exact version of the library (in this case, version 1.8.2).
google.load("jqueryui", "1");, which loads the most recent version in that branch (in this case, 1.8.2).
Each library is available via both google.load() and directly, via a <script> include. The google.load() approach offers the most functionality, while additional performance is gained by using the <script> tag approach.
The following section lists all of the libraries currently supported by the API. We list the library name (the name used in google.load()) and all of the supported versions.
If you encounter problems: