Sometimes we need our links to do something else besides going to another http location. Perhaps we want to allow visitor to use other ways to interact with us using email, sms, a call, or others. Let’s se how to.
<a href="mailto:firstname.lastname@example.org">Send me an email</a> will generate an anchor that, when clicked, will tell the browser to open the application in charge of handling email on your system.
More “complex” examples:
- Specify the subject:
<a href="mailto:email@example.com?subject=Hello">Send email</a>
- Specify the subject and body:
<a href="mailto:firstname.lastname@example.org?subject=Hello&body=This%20is%20a%20message">Send email</a>
More details on RFC 6068 - The mailto URI Scheme.
A little different:
- Just open the SMS app:
<a href="sms:">Send SMS</a>
- Open the SMS app for a certain number:
<a href="sms:+1-555-111-1111">Send SMS</a>
- Open the SMS app with custom message:
<a href="sms:+1-555-111-1111?body=I%20want%this%20product">Request Product</a>
Same idea here:
- Open the dial app on the device:
<a href="tel:+1-555-111-1111">Call me</a>
More details on RFC 3966 - The tel URI for Telephone Numbers and in Section 8 is adviced to always enclose the phone number inside the
<a> tag, so the correct way for previous example should be something like:
Call me at <a href="tel:+1-555-111-1111">1-555-111-1111<a>.
If you want the link to open a map in a certain location:
<a href="geo:22.146147,-80.4426516">Our Office</a>
More details on RFC 5870 - A Uniform Resource Identifier for Geographic Locations.
In all cases is required that your device have a correct user agent to handle this URI schemes. In PC the tel, sms, and geo will normally not work. But in smartphone the potencial of this feature is amazing. Use it!