summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/static/api_other.html
blob: 95bf464cb9c3fc143fdecd8bd25a32084d7048e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<div id="pageData-name" class="pageData">Other APIs</div>

<p>
In addition to the
<a href="api_index.html">chrome.* APIs</a>,
extensions can use all the APIs
that the browser provides
to web pages and apps.
If the browser doesn't support an API you want to use,
you can bundle additional API libraries into your extension.
</p>

<p>Here's a sampling of the APIs that extensions can use:</p>

<dl>
<dt><strong> Standard JavaScript APIs </strong></dt>
<dd> These are the same core JavaScript and
  <a href="http://www.w3.org/TR/DOM-Level-2-HTML/">Document Object Model</a>
  (DOM) APIs
  that you can use in ordinary web apps.
  <!-- [PENDING: check! should link to complete list] -->
<!-- Use onclick in your toolbar div to add click behavior.
E.g. window.open(someUrl). --></dd>
<dt><strong> XMLHttpRequest </strong></dt>
<dd>
  Use <a href="xhr.html">XMLHttpRequest</a>
  to request data from one or more servers.
  The <a href="manifest.html#permissions">permissions</a> field
  of the manifest specifies
  which hosts the extension can send requests to.
  </dd>
<dt> <strong>HTML5 and other emerging APIs</strong></dt>
<dd> Google Chrome supports HTML5 features,
     along with other emerging APIs.
     Here are some of the APIs you can use:
  <ul>
  <li> audio
    (<a href="http://www.html5rocks.com/tutorials/audio/quick/">tutorial</a>) </li>
  <li> app cache
    (<a href="http://www.html5rocks.com/tutorials/appcache/beginner/">tutorial</a>) </li>
  <li> canvas </li>
  <li> geolocation
    (<a href="http://www.html5rocks.com/tutorials/geolocation/trip_meter/">tutorial</a>) </li>
  <li> local storage </li>
  <li> notifications
    (<a href="http://www.html5rocks.com/tutorials/notifications/quick/">tutorial</a>) </li>
  <li> session storage </li>
  <li> video </li>
  <li> web database
    (<a href="http://www.html5rocks.com/tutorials/webdatabase/todo/">tutorial</a>) </li>
  </ul>
  <p>
  See <a href="http://www.html5rocks.com">html5rocks.com</a>
  for HTML5 information, tutorials, an interactive playground,
  and links to other resources.
  </p>
</dd>

<dt><strong> WebKit APIs </strong></dt>
<dd>
  Because Google Chrome is built upon WebKit,
  your extensions can use WebKit APIs.
  Especially useful are the experimental CSS features
  such as filters, animations, and transformations.
  Here's an example of using WebKit styles
  to make the UI spin:
  <pre>&lt;style>
  div:hover {
    -webkit-transform: rotate(360deg);
    -webkit-transition: all 1s ease-out;
  }
&lt;/style>
</pre>
  <!-- [PENDING: link to complete list of webkit apis] -->
</dd>
<dt><strong> V8 APIs</strong>, such as<strong> JSON </strong></dt>
<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>
<dt><strong>APIs in bundled libraries</strong></dt>
<dd> If you want to use a library that the browser doesn't provide
(for example, jQuery),
you can bundle that library's JavaScript files with your extension.
Bundled libraries work in extensions
just as they do in other web pages.
</dd>
</dl>