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