javascript - 如何检测用户是否接受或拒绝 iOS 上的调用提示?

标签 javascript html ios

在 iOS 上,当我做 <a href="tel:1234">call me</a> , 会弹出提示。

我如何在 javascript 中检测用户是取消还是接受调用电话?

onBlur and onFocus不会在 iOS 上触发。

谢谢。

最佳答案

简答 不,这在网页上是不可能的。如果您通过使用自定义提示创建 native 应用程序,这可能是可能的。

长答案

此提示是对 911 漏洞的响应。 https://9to5mac.com/2017/03/06/911-ios-exploit/

在10.3 Release notes中可以看到 https://developer.apple.com/library/content/releasenotes/General/RN-iOSSDK-10.3/

此行为在 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.)

根据 RFC 3966 : 11. 安全考虑

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.

另见 Suppressing the native dialog when clicking on a tel: link

关于javascript - 如何检测用户是否接受或拒绝 iOS 上的调用提示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46619467/

相关文章:

javascript - RabbitMQ 与通过 web 的 stomp 适配器

javascript - 未检查的最后一个错误值 : Error: No matching window - I get this error when trying to execute script with command in Firefox WebExtension

html - 样式化多个 :select dropdowns to display inline

javascript - getElementById(...) 为空。在 Firebug 中工作正常

ios - 按位置从 iOS 照片库中获取照片

ios - 如何刷新 NimbusPhotos 示例应用程序中的图片?

javascript - 第二次单击中的 Jquery 单击方法不起作用

javascript - 在原型(prototype)代理之上分配一个属性

html - 表格单元格中的单选按钮未正确对齐

ios - 在 CALayer 中应用透明颜色