WebKit Offers Early Preview of ‘Web Intents’
Originally developed by Google’s Paul Kinlan, Web Intents are a kind of meta-website API that would allows sites to easily pass data between each other — for example, to edit a photograph or share a URL with friends.
Since Kinlan initially proposed Web Intents — which are based on a similar system used in Google’s Android operating system — Mozilla and several other companies have joined forces to work on standardizing Web Intents.
Web Intents offer a way to connect your favorite sites to each other and pass data between them. The canonical example is a photo-sharing website that wants to let you edit your uploaded images. To do that, the site simply adds a button, Edit This Photo, and behind the scenes the new
<intent> tag tells the browser that the button wants to connect to a photo-editing service. The browser would then either connect to your favorite online photo editor or offer a list of options.
In practice Web Intents work a bit like
mailto: links, defining an action and then passing it along to the browser, which allows the user to choose how to handle the action. The difference is that instead of opening a desktop app, Web Intents connect to web services. Here’s a barebones example of what the tag looks like (taken from webintents.org):
<intent action="http://webintents.org/share" type="image/*" href="image.html" title="Kinlan's Image Share" />
example the browser would then give the user a list of registered image sharing apps — services like Twitter, Facebook, Google+ and so on — which the user can choose from.
Part of what makes Web Intents appealing is that it decouples services. Instead of waiting for Flickr to support the latest and greatest online photo editor, Flickr could simply add an intent tag and let you choose any editor you like, including that cool new one that’s still a private beta. Flickr would simply pass the image to the editor of your choice and when you’re done tweaking your photo the editor would then pass the final image back to Flickr.
Other use cases for Web Intents include choosing a preferred search engine, cloud printing, logging into websites and, of course, sharing something on your preferred social networks.
As Çelik writes, “web actions have the potential to change our very notions of what a web application is from a single site to loosely coupled interactions across multiple, distributed sites…. In that regard, web actions have the potential to become a building block for distributed web applications.”
Web Intents are a long way from a finalized standard and while many things may change before other browsers add support, if you’d like to get a sense of what you can do with Web Intents and how they work in practice grab the latest WebKit nightly build and point it at the examples page on webintents.org.
Image: Aidan Jones/CC/Flickr