HTML and CSS Reference
In-Depth Information
Figure 12-11. The Web Intents view on Chrome
As you can see, this puts the user in control of what they'd like to do with the web content. Listing 12-11 shows
how to work with the Web Intents API to yield this image.
Listing 12-11. Web Intents Example
<script>
var intentParams = {
"action": " http://webintents.org/share " ,
"type": "image/*",
"data": location.href
};
var intent = new Intent(intentParams);
window.navigator.startActivity(intent);
</script>
As you can see, you create a new intent with an image file, and at this point, any of the user's applications
registered to support an image-based intent can handle this for the user. This could be Facebook, Mail, Instagram, any
installed application, or a web application. For more information about Web Intents, visit http://webintents.org
and http://w3.org/TR/web-intents .
MIME and Protocol API
Do you have a smartphone? Chances are, if you're reading this topic, you have an iPhone, Android, BlackBerry, or
Windows Phone. Have you ever noticed how phone numbers or e-mail addresses on web content are displayed as
clickable or tappable links? Well, this link uses a different protocol than your normal HTTP or HTTPS request using
<a href> . It uses the TEL: and MAILTO: protocols, which allows the native telephone or mail application to handle
 
Search WWH ::




Custom Search