Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

New HTML5 elements and attributes

Saturday, October 19th, 2013 by Servage

HTML5 APIs
An API (Application Programming Interface) is a documented set of commands, data names, and so on, that lets one software application communicate with another. For example, the developers of Twitter documented the names of each data type (users, tweets, timestamps, and so on) and the methods for accessing them in an API document (dev.twitter.com/docs) that lets other developers include Twitter feeds and elements in their programs. That is why there are so many Twitter programs and widgets available. Amazon.com also opens up its product data via an API. In fact, publishers of all ilks are recognizing the power of having their content available via an API. You could say that APIs are hot right now.

But let’s bring it back to HTML5, which includes APIs for tasks that traditionally required proprietary plug-ins (like Flash) or custom programming. The idea is that if browsers offer those features natively—with standardized sets of hooks for accessing them—developers can do all sorts of nifty things and count on it working in all browsers, just as we count on the ability to embed an image on a page today. Of course, we have a way to go before there is ubiquitous support of these cutting-edge features, but we’re getting there steadily. Some APIs have a markup component, such as embedding multimedia with the new HTML5 video and audio elements. Others happen entirely behind the scenes with JavaScript or server-side components, such as creating web applications that work even when there is no Internet connection (Offline Web Application API).

The W3C and WHATWG are working on lots and lots of APIs for use with web applications, all in varying stages of completion and implementation. Most have their own specifications, separate from the HTML5 spec itself, but they are generally included under the wide HTML5 umbrella that covers web-based applications. HTML5 includes specifications for these APIs:
Media Player API
For controlling audio and video players embedded on a web page, used with the new video and audio elements. We will take a closer look at audio and video later in this chapter.
Session History API
Exposes the browser history for better control over the Back button.
Offline Web Application API
Makes it possible for a web application to work even when there is no Internet connection. It does it by including a manifest document that lists all of the files and resources that should be downloaded into the browser’s cache in order for the application to work. When a connection is available, it checks to see whether any of the documents have changed, then updates those documents.
Editing API
Provides a set of commands that could be used to create in-browser text editors, allowing users to insert and delete text, format text as bold, italic, or as a hypertext link, and more. In addition, there is a new content editable attribute that allows any content element to be editable right on the page.
Drag and Drop API
Adds the ability to drag a text selection or file to a target area on the page or another web page. The draggable attribute indicates the element can be selected and dragged. The dropzone attribute is used on the target area and defines what type of content it can accept (text or file type) and what to do with it when it gets there (copy, link, move).

Resources for further reading

New HTML5 elements and attributes, 3.7 out of 5 based on 3 ratings
Categories: Guides & Tutorials

Keywords:

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.