Introduction to Web Intents
Paul Kinlan (@paul_kinlan)
G+: plus.ly/paul.kinlan
Paul Kinlan (@paul_kinlan)
G+: plus.ly/paul.kinlan
Web Intents is a framework for client-side service discovery and inter-application communication
var intent = new Intent("http://webintents.org/share",
"text/uri-list",
window.location.href);
window.navigator.startActivity(intent);
var intent = new Intent("http://webintents.org/share",
"text/uri-list",
window.location.href);
window.navigator.startActivity(intent);
A verb.
var intent = new Intent("http://webintents.org/share",
"text/uri-list",
window.location.href);
window.navigator.startActivity(intent);
A description of the data being used
var intent = new Intent("http://webintents.org/share",
"text/uri-list",
window.location.href);
window.navigator.startActivity(intent);
The data by value or reference (URL)
Can be complex types such as images, audio or documents
<intent action="http://webintents.org/share" type="image/*" href="shareimage.html" >
When launched, data on:
window.intent
Client:
var intent = new Intent("http://webintents.org/pick", "image/*");
window.navigator.startActivity(intent, function(intentData) {
// Do something with the response
});
Service:
window.intent.postResponse({ ... some data ... });
var intent = new Intent("http://webintents.org/pick", "image/*");
window.navigator.startActivity(intent, function(intentData) {
var pickedImage = document.getElementById("picked");
pickedImage.src = intentData.data;
});
* - next version of the shim
Client:
var channel = MessageChannel();
var intent = new Intent("http://webintents.org/pick",
"image/*",
channel.port1);
window.navigator.startActivity(intent);
This will change the way we build apps on the web - Paul Kinlan