In the rapidly evolving arena of browser standards, among the newest additions is a tag that significantly facilitates the transfer and sharing of data between online applications and services.

The Google-originated ‘Web Intents’ API gives a user the ability to select an application to perform a specific action on a designated piece of data, such as an image, audio or video file, or text file.

Here’s how the feature works:

Say, for instance, a person wants to edit or share a photo that has been uploaded to a hosting service. The host may not possess an internal editing function, or be associated with an established third-party application.

However, by clicking on an Edit button, the user is able to choose a desired online editor to perform the job.

In its most basic form, the tag for an image edit looks like this:

<intent
action="http://webintents.org/edit"
type="image/*"
href="edit.html"
/>

An example of the accompanying client-side script is:

document.getElementById('edit-photo').onclick = function() {
var intent = new Intent("http://webintents.org/edit",
"text/uri-list;type=image/jpeg",
getImageDataURI(...));
navigator.startActivity(intent, imageEdited);
};

function imageEdited(data) {
document.getElementById('image').src = data;
}

After the photo has been edited, perhaps the user may want to share it via a desired social networking site, thusly:

document.getElementById('share-photo').onclick = function() {
var intent = new Intent("http://webintents.org/share",
"text/uri-list;type=image/jpeg",
getPublicURIForImage(...));
navigator.startActivity(intent);
};

In short, the developer of an image gallery can incorporate the options for users to both edit and share their pictures without having to separately design the features. Providing the user with the opportunity to choose a preferred service is the cherry on top of the ice cream.

The user-agent informs as to whether a given service is able to process Web Intents, and if so, the type of data that is permissible to be transferred.

On the page of the hypothetical image editing service, the coding would look like:

<html>
<head>
<title>Image Editor</title>
</head>
<body>
<intent action="http://webintents.org/edit" type="text/uri-list;type=image/*,image/*"></intent>
<script>
window.onload = function() {
if (window.intent) {
setImageContentURI(window.intent.data);
}
};

document.getElementById('save-button').onclick = function() {
window.intent.postResult(getImageDataURI(...));
};
</script>

Benefits

Both users and developers will profit from the standardization of Web Intents. From the user standpoint, rather than being forced to accept, for example, a less capable photo editor that might be integrated with a given host or gallery, he or she can happily store photos there, but retain the ability to select a preferred service.

For a developer who wants to create a photo gallery, the primary focus can now be placed on the UI and storage aspects, instead of having to also worry about adding an editing functionality. Total project development time can therefore be considerably reduced, and without any diminishment of user satisfaction.

The Web, if nothing else, is a multifaceted venue for exercising individual choice. The proposed Web Intents API would enrich that ability by allowing for a seamless integration between online applications and services.

Currently, the following Intents actions are available: Discover, Share, Edit, View, Pick, Subscribe, and Save. A W3C task force is developing the API. For older browsers, there is an API-compatible Javascript Shim, which is supported by IE8, IE9, Opera, Safari, Firefox 3.0+ and Chrome 3.0+.

Due to the fact that Web Intents are client-side in nature, they provide users a great degree of control over the data transaction. As more websites incorporate the appropriate coding, user options for desired applications and services will continue to expand.

History

The Web Intents project was announced back in December 2010 by Google Developer Advocate Paul Kinlan, in response to the stated need for integration between independent online services in order to complete specific tasks.

In his blog, Kinlan calls the lack of integration between online services “a huge problem on the web,” and touts Web Intents as an effective solution.

Inspired by the Android Intent system, the ultimate objective of the team working on Intents is to develop an API that allows for easy, ‘copy and paste’ coding integration.

In overall scope, Kinlan posited that Web Intents has the capacity to engender fundamental change in the way that user applications are built on the Web.

Latest News

Google has announced the enabling of Web Intents in Chrome 19, via an extension. Implementation for Safari can be accomplished through Webkit. Mozilla is reportedly hoping to soon add the functionality to Firefox.

Conclusion

Though full integration with all of the major browsers will not occur for some time, the many potential uses of Web Intents are exciting to contemplate. With the burgeoning popularity of online image sharing and customization, for example, the feature should find a ready-made market from its outset.

By David Elliot
David is a long-time journalist and editor who also has over 10 years experience as a freelance Web developer, specializing in online newspaper design and maintenance.
  • virtualCableTV

    I consider Paul Kinlan et al. rank liars of ommission when he amongst others of his sleazy ilk claims in his blog he “anounced” Web Intents in 2010 when in fact Internet Explore 8 was released in 2009 anf IE8 was the first browser to support what Microsoft called Accelerators. Look it up chumps.

    These weasels like Google and such even stole the category names from Microsoft and are taking credit for the client-side use of asynchronous services which Microsoft browsers support using an XML file instead of having to copy and paste into the head of HTML files.

    Really, what a bunch of low class punks.

Home XML WordPress Web Services Web Development Web Design Underscore Uncategorized Tutorial Tools SQL Server Social Apps Snippet SEO Security RoR Responsive Design Resources Python PHP News MySQL Mobile Miscellaneous jQuery JavaScript Java J2EE HTML5 HTML Design Patterns