How do I detect whether user accepts or rejects call prompt on iOS?

Viewed 220

On iOS, when I do <a href="tel:1234">call me</a>, the prompt will pop up.

How do I detect in javascript whether user cancels or accepts to make the call?

onBlur and onFocus doesn't get fired on iOS.

Thanks.

1 Answers

Short answer No, this is not possible from a web page. It may be possible if you create an native application, by using custom prompt.

Long answer

This prompt is in response to the 911 exploit. https://9to5mac.com/2017/03/06/911-ios-exploit/

You can see it added in 10.3 Release notes https://developer.apple.com/library/content/releasenotes/General/RN-iOSSDK-10.3/

The behaviour is further explained in https://developer.apple.com/library/content/featuredarticles/iPhoneURLScheme_Reference/PhoneLinks/PhoneLinks.html

The tel URL scheme is used to launch the Phone app on iOS devices and initiate dialing of the specified phone number. When a user taps a telephone link in a webpage, iOS displays an alert asking if the user really wants to dial the phone number and initiates dialing if the user accepts. When a user opens a URL with the tel scheme in a native app, iOS 10.3 and later displays an alert and requires user confirmation before dialing. (When this scenario occurs in versions of iOS prior to 10.3, iOS initiates dialing without further prompting the user and does not display an alert, although a native app can be configured to display its own alert.)

According to RFC 3966: 11. Security Considerations

Web clients and similar tools MUST NOT use the "tel" URI to place telephone calls without the explicit consent of the user of that client. Placing calls automatically without appropriate user confirmation may incur a number of risks, such as those described below:

o Calls may incur costs.

o The URI may be used to place malicious or annoying calls.

o A call will take the user's phone line off-hook, thus preventing its use.

o A call may reveal the user's possibly unlisted phone number to the remote host in the caller identification data and may allow the attacker to correlate the user's phone number with other information, such as an e-mail or IP address.

Also see Suppressing the native dialog when clicking on a tel: link

Related