Introduction to
Web Intents/Actions

Glenn Jones
2 January 2012

Rise of the sharing buttons

Hundreds of services

Billions of interactions every year

In 2011 the StumbleUpon “Stumble” button recorded its 25 billionth click. On AddThis network StumbleUpon has only 1.69% marketshare of services

Visual overload and no user choice

  • Post a Status
  • Edit an Image
  • Bookmark a Page
  • Reply to Post
  • Pick a Profile

Demo: Pick a contact



Demo: Pick a social profile

Three taps on a mobile device

The technical bit

The code under the hood

Registering a Web Intent

<intent
    action="http://webintents.org/pick" 
    type="text/x-vcard" 
    href="http://codebits.glennjones.net/contact-intent/" 
    title="Pick a profile">
</intent>
      

Sending data to a service

<script>        
    var intent = new Intent();            
    intent.action = "http://webintents.org/save";            
    intent.type = "text/x-vcard";            
    intent.data = card;            

    window.navigator.startActivity(intent);
</script> 
        

Receiving data from a service

<script> 
    var intent = new Intent(); 
    intent.action = "http://webintents.org/pick";
    intent.type = "text/x-vcard ";  
    window.navigator.startActivity(intent, returnSelection) 

    function returnSelection(data){ 
        var cards = data;
    }
</script>