OLD | NEW |
(Empty) | |
| 1 <h1>Other APIs</h1> |
| 2 |
| 3 <p> |
| 4 In addition to the |
| 5 <a href="api_index.html">chrome.* APIs</a>, |
| 6 extensions can use all the APIs |
| 7 that the browser provides |
| 8 to web pages and apps. |
| 9 If the browser doesn't support an API you want to use, |
| 10 you 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="https://developer.mozilla.org/en/Gecko_DOM_Reference">Document Object
Model</a> |
| 19 (DOM) APIs |
| 20 that you can use in ordinary web apps. |
| 21 |
| 22 <!-- Use onclick in your toolbar div to add click behavior. |
| 23 E.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 |
| 42 (<a href="http://www.html5rocks.com/en/tutorials/#canvas">articles</a>) </li
> |
| 43 <li> geolocation |
| 44 (<a href="http://www.html5rocks.com/tutorials/geolocation/trip_meter/">tutor
ial</a>) </li> |
| 45 <li> local storage |
| 46 (<a href="http://www.html5rocks.com/en/tutorials/offline/storage/">tutorial<
/a>) </li> |
| 47 <li> notifications |
| 48 (<a href="http://www.html5rocks.com/tutorials/notifications/quick/">tutorial
</a>) </li> |
| 49 <li> video |
| 50 (<a href="http://www.html5rocks.com/en/tutorials/video/basics/">tutorial</a>
) </li> |
| 51 <li> web database |
| 52 (<a href="http://www.html5rocks.com/tutorials/webdatabase/todo/">tutorial</a
>) </li> |
| 53 </ul> |
| 54 <p> |
| 55 See <a href="http://www.html5rocks.com">html5rocks.com</a> |
| 56 for HTML5 information, tutorials, an interactive playground, |
| 57 and links to other resources. |
| 58 </p> |
| 59 </dd> |
| 60 |
| 61 <dt><strong> WebKit APIs </strong></dt> |
| 62 <dd> |
| 63 Because Google Chrome is built upon WebKit, |
| 64 your extensions can use WebKit APIs. |
| 65 Especially useful are the experimental CSS features |
| 66 such as filters, animations, and transformations. |
| 67 Here's an example of using WebKit styles |
| 68 to make the UI spin: |
| 69 <pre><style> |
| 70 div:hover { |
| 71 -webkit-transform: rotate(360deg); |
| 72 -webkit-transition: all 1s ease-out; |
| 73 } |
| 74 </style> |
| 75 </pre> |
| 76 |
| 77 </dd> |
| 78 <dt><strong> V8 APIs</strong>, such as<strong> JSON </strong></dt> |
| 79 <dd> Because JSON is in V8, you don't need to include a JSON library to use JSON
functions. </dd> |
| 80 <dt><strong>APIs in bundled libraries</strong></dt> |
| 81 <dd> If you want to use a library that the browser doesn't provide |
| 82 (for example, jQuery), |
| 83 you can bundle that library's JavaScript files with your extension. |
| 84 Bundled libraries work in extensions |
| 85 just as they do in other web pages. |
| 86 </dd> |
| 87 </dl> |
OLD | NEW |