HTML5 APIs
Amazon Silk supports many of the HTML5 APIs. Though not intended to be comprehensive, the list below describes supported HTML5 APIs and notes any Amazon Silk-specific implementation details.
Topics
Animation Timing API
The Animation Timing API can be used to create script-based animations where the user
agent is called upon to determine the appropriate frame update rate at runtime. This allows
animations to run more smoothly and efficiently than they would with the
setInterval
or setTimeout
methods, which schedule callbacks at
specified intervals.
To learn more about the Animation Timing API, see the W3C specification Timing Control for Script-based
Animations
Application Cache API
The Application Cache API, or AppCache, enables web applications to run offline. AppCache can also improve application performance, as cached resources load faster and reduce server load.
To learn more about the HTML5 Application Cache, see the following resources:
Cross-Origin Resource Sharing
The Cross-Origin Resource Sharing (CORS) specification defines a method for making HTTP requests that are not limited by the same-origin policy. The same-origin policy restricts scripts from one domain from interacting with resources from a different domain. But when CORS is implemented, a web client can fetch resources from an origin other than its own. In practice, CORS requests are usually made through the XMLHttpRequest API.
Browsers handle the client-side implementation of CORS. This means that you can use XMLHttpRequest to make cross-origin requests, and Amazon Silk will take care of the HTTP request header and any necessary preflight requests (requests for authorization from cross-origin servers).
To learn more about CORS, see the following resources:
File API
The File API provides a secure, standardized way for web applications to interact with local files. Using the File API, a web application can represent file objects, programmatically select them, and parse file data.
For more information, see the W3C File
API
File System API
Using the File System API, a web application can create and interact with files in a sandboxed virtual file system on the client. The File System API gives web applications a way to store files, including large binary blobs, locally without using a database.
For more information, see the following resources:
Geolocation API
The Geolocation API provides an interface to a device's location information, returned as coordinates of latitude and longitude. The first time an app or website tries to access device location with the Geolocation API, the browser has to obtain user permission. All browsers that support the Geolocation API must respect this requirement, although the implementation varies. Amazon Silk prompts the user with a dialog requesting permission.
![](/images/silk/latest/developerguide/images/share_location.png)
In the Settings menu, Silk users can disable location access for an individual website or for all websites.
As a developer, you can use the Geolocation API to get an initial position for a device and to watch for changes of position.
To learn more about the Geolocation API, see the following resources:
Indexed Database API
The Indexed Database API, or IndexedDB API, is an interface to a high-performance, object-oriented database that can store large amounts of structured data on the browser. Data objects are stored as key-value pairs and can be accessed on- or offline.
For more information, see the W3C Indexed DB
specification
Server-Sent Events
The Server-Sent Events interface enables a client to receive updates from the server automatically without having to request them. You can use Server-Sent Events to display news and other updates on a website.
For more information, see the W3C
Server-Sent Events specification
Touch Events
Touch Events interpret finger motions on a touch-sensitive screen, so that web
applications can handle touch input directly. Touch events include touchstart
,
touchend
, touchcancel
, and touchmove
.
To learn more about Touch Events, see the following resources:
XMLHttpRequest Level 2
The XMLHttpRequest API enables a web application to make asynchronous HTTP requests to the server. XMLHttpRequest Level 2, which is sometimes associated with HTML5, introduces new functionality. For example, with XMLHttpRequest Level 2, you can use the Cross-Origin Resource Sharing (CORS) API to make secure cross-origin requests, and you can transfer binary data in a straightforward way.
For more information, see the W3C specification XMLHttpRequest Level 2
Web SQL Database
The Web SQL Database API is an interface for storing data on the client in a database that can be queried with SQLite. The W3C no longer actively maintains the Web SQL Database specification.
For more information, see the W3C Web SQL
Database specification
Web Storage
Web Storage is an interface for storing data in key-value pairs on the client. It's designed to be a faster, more secure alternative to cookies. The Web Storage API provides two storage types: local storage and session storage. Local storage has no expiration date, while session storage persists for one session only.
To learn more about the Web Storage API, see the following resources:
Web Workers API
The Web Workers API can improve application performance by enabling JavaScript to run as a background process. When a script runs as a Worker object, it's executed on a background thread, in parallel to the main page. This prevents the script from affecting UI performance.
For more information about the Web Workers API, see the W3C Web Workers specification
WebGL
WebGL is a web standard that facilitates the rendering of interactive 3-D graphics in the
browser without a plugin. Based on OpenGL ES 2.0, WebGL specifies both a JavaScript API and
interaction with the graphics processing unit (GPU). The HTML5 canvas
element
functions as the rendering context. Amazon Silk has enabled WebGL and supports most WebGL
functionality.
For WebGL initialization tests, see Khronos WEBGL FAQ
To learn more about WebGL, see the following resources:
WebSocket API
The WebSocket API facilitates event-driven client-server communication over an open connection. Using the WebSocket API, the server can send updates to the client without the client having to request resources.
To learn more about the WebSocket API, see the following resources: