• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<div id="pageData-name" class="pageData">Other APIs</div>
2
3<p>
4In addition to the
5<a href="api_index.html">chrome.* APIs</a>,
6extensions can use all the APIs
7that the browser provides
8to web pages and apps.
9If the browser doesn't support an API you want to use,
10you can bundle additional API libraries into your extension.
11</p>
12
13<p>Here's a sampling of the APIs that extensions can use:</p>
14
15<dl>
16<dt><strong> Standard JavaScript APIs </strong></dt>
17<dd> These are the same core JavaScript and
18  <a href="http://www.w3.org/TR/DOM-Level-2-HTML/">Document Object Model</a>
19  (DOM) APIs
20  that you can use in ordinary web apps.
21  <!-- [PENDING: check! should link to complete list] -->
22<!-- Use onclick in your toolbar div to add click behavior.
23E.g. window.open(someUrl). --></dd>
24<dt><strong> XMLHttpRequest </strong></dt>
25<dd>
26  Use <a href="xhr.html">XMLHttpRequest</a>
27  to request data from one or more servers.
28  The <a href="manifest.html#permissions">permissions</a> field
29  of the manifest specifies
30  which hosts the extension can send requests to.
31  </dd>
32<dt> <strong>HTML5 and other emerging APIs</strong></dt>
33<dd> Google Chrome supports HTML5 features,
34     along with other emerging APIs.
35     Here are some of the APIs you can use:
36  <ul>
37  <li> audio
38    (<a href="http://www.html5rocks.com/tutorials/audio/quick/">tutorial</a>) </li>
39  <li> application cache
40    (<a href="http://www.html5rocks.com/tutorials/appcache/beginner/">tutorial</a>) </li>
41  <li> canvas </li>
42  <li> geolocation
43    (<a href="http://www.html5rocks.com/tutorials/geolocation/trip_meter/">tutorial</a>) </li>
44  <li> local storage </li>
45  <li> notifications
46    (<a href="http://www.html5rocks.com/tutorials/notifications/quick/">tutorial</a>) </li>
47  <li> session storage </li>
48  <li> video </li>
49  <li> web database
50    (<a href="http://www.html5rocks.com/tutorials/webdatabase/todo/">tutorial</a>) </li>
51  </ul>
52  <p>
53  See <a href="http://www.html5rocks.com">html5rocks.com</a>
54  for HTML5 information, tutorials, an interactive playground,
55  and links to other resources.
56  </p>
57</dd>
58
59<dt><strong> WebKit APIs </strong></dt>
60<dd>
61  Because Google Chrome is built upon WebKit,
62  your extensions can use WebKit APIs.
63  Especially useful are the experimental CSS features
64  such as filters, animations, and transformations.
65  Here's an example of using WebKit styles
66  to make the UI spin:
67  <pre>&lt;style>
68  div:hover {
69    -webkit-transform: rotate(360deg);
70    -webkit-transition: all 1s ease-out;
71  }
72&lt;/style>
73</pre>
74  <!-- [PENDING: link to complete list of webkit apis] -->
75</dd>
76<dt><strong> V8 APIs</strong>, such as<strong> JSON </strong></dt>
77<dd> Because JSON is in V8, you don't need to include a JSON library to use JSON functions. <!-- [PENDING: what other APIs are in v8? link to complete list] --></dd>
78<dt><strong>APIs in bundled libraries</strong></dt>
79<dd> If you want to use a library that the browser doesn't provide
80(for example, jQuery),
81you can bundle that library's JavaScript files with your extension.
82Bundled libraries work in extensions
83just as they do in other web pages.
84</dd>
85</dl>
86
87