Introduction
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.
Sign up for an API key
To begin using the Google APIs, first you need to sign up for an API key. The API key costs nothing, and allows us to contact you directly if we detect an issue with your site.
Load the API
To begin using the Libraries API, include the following script in the header of your web page. Enter your own Google API key where it says INSERT-YOUR-KEY
.
Warning: This example won't work unless you use your own API key. In the example below, replace "INSERT-YOUR-KEY
" with your own, unique key.
<script type="text/javascript" src="https://www.google.com/jsapi?key=INSERT-YOUR-KEY"></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.4.2/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", "1.0.2");
google.load("dojo", "1.6.0");
google.load("ext-core", "3.1.0");
google.load("jquery", "1.6.0");
google.load("jqueryui", "1.8.12");
google.load("mootools", "1.3.2");
google.load("prototype", "1.7.0.0");
google.load("scriptaculous", "1.8.3");
google.load("swfobject", "2.2");
google.load("yui", "3.3.0");
google.load("webfont", "1.0.19");
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.
Versioning
google.load
gives you two ways to specify which version of the library you wish to load. You can request:
- A specific version (such as
google.load("jqueryui", "1.8.2");
, which loads that exact version of the library (in this case, version1.8.2
). - A truncated version (such as
google.load("jqueryui", "1");
, which loads the most recent version in that branch (in this case,1.8.2
).
Libraries
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.
- Chrome Frame
- name: chrome-frame
- latest version: 1.0.2 (view older versions)1.0.0, 1.0.1
- load request:
google.load("chrome-frame", "1.0.2");
- extras:
uncompressed:true
(as ingoogle.load("chrome-frame", "1.0.2", {uncompressed:true});
- path: https://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js
- path(u): https://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.js
- site: https://code.google.com/chrome/chromeframe/
- Dojo
- name: dojo
- latest version: 1.6.0 (view older versions)1.1.1, 1.2.0, 1.2.3, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.3, 1.5.0, 1.5.1
- load request:
google.load("dojo", "1.6.0");
- extras:
uncompressed:true
(as ingoogle.load("dojo", "1.6.0", {uncompressed:true});
- path: https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js
- path(u): https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js.uncompressed.js
- site: http://dojotoolkit.org/
- Ext Core
- name: ext-core
- latest version: 3.1.0 (view older versions)3.0.0
- load request:
google.load("ext-core", "3.1.0");
- extras:
uncompressed:true
(as ingoogle.load("ext-core", "3.1.0", {uncompressed:true});
- path: https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js
- path(u): https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core-debug.js
- site: http://www.sencha.com/products/extjs/
- jQuery
- name: jquery
- latest version: 1.6.0 (view older versions)1.2.3, 1.2.6, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.5.0, 1.5.1, 1.5.2
- load request:
google.load("jquery", "1.6.0");
- extras:
uncompressed:true
(as ingoogle.load("jquery", "1.6.0", {uncompressed:true});
- path: https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js
- path(u): https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.js
- site: http://jquery.com/
- note: 1.2.5 and 1.2.4 are not hosted due to their short and unstable lives in the wild...
- jQuery UI
- name: jqueryui
- latest version: 1.8.12 (view older versions)1.5.2, 1.5.3, 1.6.0, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.8.0, 1.8.1, 1.8.2, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.8.9, 1.8.10, 1.8.11
- load request:
google.load("jqueryui", "1.8.12");
- extras:
uncompressed:true
(as ingoogle.load("jqueryui", "1.8.12", {uncompressed:true});
- path: https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js
- path(u): https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.js
- site: http://jquery.com/
- note: This library depends on jquery. You must also load jquery before loading this module. Version 1.8.3 is not hosted due to its short life, and the alias
1.8.3
actually loads 1.8.4.
- MooTools
- name: mootools
- latest version: 1.3.2 (view older versions)1.1.1, 1.1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1
- load request:
google.load("mootools", "1.3.2");
- extras:
uncompressed:true
(as ingoogle.load("mootools", "1.3.2", {uncompressed:true});
- path: https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js
- path(u): https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools.js
- site: http://mootools.net/
- note: Since 1.1 versions are not compatible with 1.2 versions, specifying version "1" will map to the latest 1.1 version (currently 1.1.2).
- Prototype
- name: prototype
- latest version: 1.7.0.0 (view older versions)1.6.0.2, 1.6.0.3, 1.6.1.0
- load request:
google.load("prototype", "1.7.0.0");
- path: https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js
- site: http://prototypejs.org/
- script.aculo.us
- name: scriptaculous
- latest version: 1.8.3 (view older versions)1.8.1, 1.8.2
- load request:
google.load("scriptaculous", "1.8.3");
- path: https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js
- site: http://prototypejs.org/
- note: This library depends on
Prototype
. Before loading this module, you must load Prototype.
- SWFObject
- name: swfobject
- latest version: 2.2 (view older versions)2.1
- load request:
google.load("swfobject", "2.2");
- extras:
uncompressed:true
(as ingoogle.load("swfobject", "2.2", {uncompressed:true});
- path: https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js
- path(u): https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js
- site: http://code.google.com/p/swfobject/
- Yahoo! User Interface Library (YUI)
- name: yui
- latest version: 3.3.0 (view older versions)2.6.0, 2.7.0, 2.8.0r4, 2.8.1, 2.8.2, 2.9.0
- load request:
google.load("yui", "3.3.0");
- extras:
uncompressed:true
(as ingoogle.load("yui", "3.3.0", {uncompressed:true});
- path: https://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui-min.js
- path(u): https://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui.js
- site: http://developer.yahoo.com/yui/
- note: Versions before 3 use the YUI loader and require a slightly different path, such as https://ajax.googleapis.com/ajax/libs/yui/2.8.2/build/yuiloader/yuiloader-min.js or https://ajax.googleapis.com/ajax/libs/yui/2.8.2/build/yuiloader/yuiloader.js.
- WebFont Loader
- name: webfont
- latest version: 1.0.19 (view older versions)1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.9, 1.0.10, 1.0.11, 1.0.12, 1.0.13, 1.0.14, 1.0.15, 1.0.16, 1.0.17, 1.0.18
- load request:
google.load("webfont", "1.0.19");
- extras:
uncompressed:true
(as ingoogle.load("webfont", "1.0.19", {uncompressed:true});
- path: https://ajax.googleapis.com/ajax/libs/webfont/1.0.19/webfont.js
- path(u): https://ajax.googleapis.com/ajax/libs/webfont/1.0.19/webfont_debug.js
- site: http://code.google.com/apis/webfonts/docs/webfont_loader.html
'HTML & Script' 카테고리의 다른 글
Popup Windows: Full Screen (0) | 2011.05.25 |
---|---|
Key Code Reference Table (0) | 2011.05.24 |
meta 태그를 이용한 IE7 IE8 호환모드 랜더링 (0) | 2011.04.27 |
라디오버튼 체크 (0) | 2011.04.18 |
The Hello World of the Closure Compiler Service UI (0) | 2011.04.05 |