Emerging Web Tech: Web Intents

,
Want to master JavaScript in a week? Example based, to the point. Xah JavaScript Tutorial.

Web Intents is a emerging system for the web. It lets your web app use different other components, without having to code it. You just specify what you need. Here's a quote from http://www.webintents.org/:

Users use many different services on the web to handle their day to day tasks, such as sharing images, editing documents and listening to music. They expect their applications to be connected and to work together seamlessly.

It is impossible for developers to anticipate every new service and to integrate with every existing external service that their users prefer, and thus they must choose to integrate with a few select APIs at great expense to the developer.

Web Intents solves this. Web Intents is a framework for client-side service discovery and inter-application communication. Services register their intention to be able to handle an action on the user's behalf. Applications request to start an Action of a certain verb (share, edit, view, pick etc.) and the system will find the appropriate Services for the user to use based on the user's preference.

Here's Wikipedia description Web Intents:

Web Intents is an upcoming framework for web-based inter-application communication and service discovery.

Web Intents consists of a discovery mechanism and a very light-weight RPC system between web applications, modelled after the Intents system in Android. In the context of the framework an Intent equals an action to be performed by a provider.[1] Web Intents allow two web applications to communicate with each other, without either of them having to actually know what the other one is.

Here's a video intro from Google:

〈A brief introduction to Web Intents〉

Basic API Example

Apps that provide service is called Service. Apps that request service is called Client.

Services declare their service by “Intent Registration”, using the “intent” tag, like this:

<intent
 action="http://webintents.org/share"
 type="image/*"
 href="share.html"
 disposition="window|inline"
/>

For client apps, here's how it invokes:

var intent = new Intent("http://webintents.org/share", "text/uri-list", "http://news.bbc.co.uk");
window.navigator.startActivity(intent);

Google has a intro with code at http://www.chromium.org/developers/web-intents-in-chrome

Currently (), only Google Chrome supports it. There's a JavaScript “shim” (wrapper) to emulate support for other browsers.

Looks like the most popular use for web intents now is just web share widget 〔☛ Adding Web Share Widgets to Your Site〕.

blog comments powered by Disqus