How to Make a Phone Call from HTML on Android

Can I make a phone call from HTML on Android?

Yes you can; it works on Android too:

tel: phone_number

Calls the entered
phone number. Valid telephone numbers
as defined in the IETF RFC 3966 are
accepted. Valid examples include the
following:

* tel:2125551212
* tel: (212) 555 1212

The Android browser uses the Phone app to handle the “tel” scheme, as defined by RFC 3966.

Clicking a link like:

<a href="tel:2125551212">2125551212</a>

on Android will bring up the Phone app and pre-enter the digits for 2125551212 without autodialing.

Have a look to RFC3966

How to trigger a phone call when clicking a link in a web page on mobile phone

Most modern devices support the tel: scheme. So use <a href="tel:555-555-5555">555-555-5555</a> and you should be good to go.

If you want to use it for an image, the <a> tag can handle the <img/> placed in it just like other normal situations with : <a href="tel:555-555-5555"><img src="path/to/phone/icon.jpg" alt="Call 555-555-5555" /></a>

Phone link in HTML for iOS and Android

if you want to implement this into an app, this:

in android, you can do this to detect PhoneLinks:

 webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains("tel:")) {
if (url.startsWith("tel:")) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
startActivity(intent);
}
return true;
}
}
});

in IOS, you can enable this on UIwebView's properties, inside Detection, there is the "Phone Numbers" tick. it will detect any phone number or phoneLink.

this is the code on your website, it will automatically trigger the phone:

<a href="tel:1-408-555-5555">1-408-555-5555</a>

more info on phoneLinks (works on both systems):

https://developer.apple.com/library/safari/featuredarticles/iPhoneURLScheme_Reference/PhoneLinks/PhoneLinks.html



Related Topics



Leave a reply



Submit