HTML5 includes several new APIs that are associated with some of the new elements. The principal purpose of these APIs is to facilitate web application creation. The list from the W3.org includes:
Associated Application Programming Interfaces
Geolocation
This specification defines an API that provides scripted access to geographical location information associated with the hosting device.
- Retrieves the latitude and longitude.
- Support is increasing.
- Interactions are opt-in.
- Opt-in mechanisms are device specific and blocking.
- Uneven support requires fallback content using third party tools.
Canvas 2D Drawing
- Canvas is both an element and an API.
- The element <canvas> is a container for drawing 2D graphics that are
javascript dependent. - The canvas API (2D) is used to draw within the canvas element.
- Developed by apple as part of the OSX Dashboard.
- Current browser support:
i.Chrome 3+ ii. Explorer 9 ii. Firefox 3+ iv. Opera 10.1 v. Safari 3.2+ - For more information on using canvas as an API see “An Introduction to the
canvas 2D API” at: HTML5doctor.com.
Local Storage (Web)
- Benefits of Storing Data Locally.
- Local data can be accessed faster.
- Reduce load on the server.
- Info can be retrieved with no login.
- Stores data in key value pairs.
Web Workers
- What are Web Workers?
- Fundamentally, Web Workers provides you a chance to load a JavaScript file
dynamically and then have it process script in a background process, not
affecting the user interface and its response level. You can continue to do
whatever you want, selecting thing, clicking etc, while all Web Worker
computation influences background.
Web Sockets
This specification defines an API that enables Web pages to use the WebSocket protocol for two-way communication with a remote host.
- What is an HTML5 Web Socket?
- This is where HTML5 web sockets come in. HTML5 will be the first HTML
specification to support client side web sockets. In other words, when data
changes on the web server, the web server can send a request to client,
eliminating the need for pollingi. - Web socket example from ezinearticles.com or see endnotei.
- This is where HTML5 web sockets come in. HTML5 will be the first HTML
- Not fully supported at the time of this writing.
Messaging
-
Cross - domain Messaging
- Allows messages to be communicated across different domains. This is
available in: IE8, Firefox 3.5, Safari 4 and Opera 10.