HTML Course 5.3 Links to email, phone and other protocols


5.3 Links to Email, Phone and Other Protocols

In HTML, the <a> element’s href attribute isn’t limited to http or https URLs.
You can create links that open email clients, dial phone numbers, launch SMS apps, FTP clients, mapping tools, VoIP calls, and even custom applications.
This section covers the syntax, best practices, URL-encoding requirements, and real-world examples for each protocol.

Email Links (mailto:)

The mailto: protocol opens the user’s default email client with fields like recipient, subject, CC, BCC and body pre-filled.
All parameters after the email address must be URL-encoded and joined by &.

Part Syntax Notes
To mailto:alice@example.com One or more addresses, comma-separated
Subject ?subject=Hello%20World Spaces as %20, other chars URL-encoded
CC / BCC &cc=bob@example.com&bcc=carol@example.com Multiple recipients comma-separated
Body &body=Line1%0ALine2 %0A = newline


  Send Email to Alice

  

Phone Links (tel:)

The tel: protocol triggers the device’s dialer. Always use international format (E.164) for best compatibility: a plus sign, country code, area code, and subscriber number.

Example Result
tel:+1234567890 Dial +1 234 567 890
tel:020-1234-5678 Dial local number (may not work worldwide)

Call Us: +1 234 567 890
  

SMS Links (sms:)

The sms: protocol opens the SMS app with a recipient and optional message body.
On some platforms you use sms:+1234567890?body=Text, others require separate query syntax.



  Send SMS

  

FTP and File Protocols

You can link to ftp:// servers or local files (where supported). Browsers may block local file access for security.


Download ZIP via FTP


Open Local PDF
  

Geo & Map Links (geo: / HTTP Maps)

Use geo:latitude,longitude to open installed map apps:


View San Francisco on Map
  

Or use web-based services:


  Google Maps Link

  

VoIP & Chat Protocols

Many services support custom URI schemes:

Service URI Example
Skype Call skype:live:username?call
WhatsApp https://wa.me/1234567890?text=Hello%20there
FaceTime facetime://john@example.com

Call on Skype



  Message on WhatsApp

  

Custom and Application-Specific Protocols

Apps can register their own URI schemes. For example, a desktop app myapp:// might handle deep links:


Open Dashboard in MyApp
  

Fallback strategies often use JavaScript: attempt to open the custom protocol, then redirect to a download page if it fails.

Best Practices & URL-Encoding

  • Always URL-encode query values (spaces → %20, line breaks → %0A).
  • Use international formats for phone numbers (+CountryCodeNumber).
  • Test on target devices and browsers—behavior may vary on desktop vs mobile.
  • Provide visible text explaining what will happen (e.g., “Call Us”, “Send Email”).
  • Combine protocols responsibly; avoid unexpected app launches without user context.


Posted

in

by

Tags:

Comments

Leave a Reply