| <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> application 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><style> |
| div:hover { |
| -webkit-transform: rotate(360deg); |
| -webkit-transition: all 1s ease-out; |
| } |
| </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> |
| |