W3C Publishes Updated Draft for Clipboard APIs and Events

The W3C (World Wide Web Consortium) has an updated working draft for clipboard APIs and events. The document describes this browser API in more detail and outlines the possibilities and potential issues regarding simple clipboard operations such as copy, cut and paste in Web applications. As this document is a working draft, it is intended to become a W3C recommendation. It has not yet become a Web standard and should be considered a work in progress.

What is the benefit of a browser API?
A browser API offers extended functionalities to a browser without the need to call on external Web services or APIs. This means that there is potential for browsers to do a lot more these days and take on more of the responsibilities, as it were. A good example is the new class of browser-based audio and video APIs that support the idea of Web-based Real-Time Collaboration (WebRTC). With WebRTC, no special software is required to have a Skype or Facetime-like video call with someone else. Instead, all each person needs is a browser. But in order for that to work, the cameras, microphones, and speakers on every device with a Web browser must be programmable through the browser's Javascript engine in such a way that (a) the same Javascript code works equally well on every device and (b) the functionality of the cameras, microphones, and speakers are mashable into other Web apps. To accomplish this, the World Wide Web consortium came up with a standard set of APIs for Web audio and video. They are part of a growing class of Javascript APIs that the W3C is working on to programmatically afford compliant Web-browsers standard methods for accessing the local device's underlying subsystems including storage, display, GPS, and more. One of those subsystems is the local system's clipboard.

Why would it be necessary to change the default clipboard operations (cut, copy, paste)?
To answer this question, several use cases are suggested, including:

  • Rich content editing — It would be helpful to be able to preserve important information when copying text that contains hyperlinks or other structure.
  • Graphics with built-in semantics — By allowing copying for more than just the rendered content, it may be possible to create Web applications that allow the manipulation of rich text or graphic content.
  • Mathematical information — With mathematics content, simple copying and pasting of rendered text can lead to the loss of most of the semantics.

How is it possible to achieve this?
It is suggested that by providing Web applications with a way to override the user agent internal logic, it would be possible to enable commands even when it appears that the commands should not be available. The document goes on to describe ways to achieve this with detailed information on events (beforecopy event, beforecut event, beforepaste event), clipboard actions and events, a processing model for event dispatch, clipboard event interfaces, writing contents to the clipboard, integration with other scripts and events, pasting HTML and multipart data, and security and privacy considerations.

Other W3C APIs include Pointer Events, which handles pointer input from devices such as mouse, pen or touch screen; the Vibration API, which controls a device’s vibrator; the Indexed Database API, which provides a database of records holding simple values and hierarchical objects; the Geolocation API specification, which gives Web pages access to scripted geographical location information; and Touch Events, which represents points of contact with a touch-sensitive surface.

Further information on the clipboard API and events, as well as any of the other W3C APIs, is available on the W3C website.

Be sure to read the next Browsers article: Google Brings Chrome Dev Channel to Android

 

Comments (0)