单击tel:链接时禁止显示本机对话框 [英] Suppressing the native dialog when clicking on a tel: link

查看:79
本文介绍了单击tel:链接时禁止显示本机对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直四处寻找有关在单击电话链接时隐藏移动设备上的对话框的想法.

I have been looking around to no avail regarding suppressing the dialog box on a mobile device when clicking on a telephone link.

我们有这样的要求,用我们网站上的自定义弹出窗口替换iPhone和Android上的现有本机对话框.

We have this requirement to replace the existing native dialog on iPhone and Android with a custom popup from our website.

我们可以使用HTML5,但对于一个基本站点,我们将不使用javascript(适用于功率较低的WAP手机).

We have HTML5 at our disposal but for one basic site we are not to use javascript (for lower powered WAP phones).

是否可以通过我网站上的HTML来禁止来自浏览器的电话本机对话(Safari,chrome,firefox?)?

Is there a way to suppress the phone native dialog coming from the browser (safari, chrome, firefox? ) via HTML from my site?

谢谢

推荐答案

如果用例允许您避免使用tel:链接格式,则可以将数字放在看起来像链接的其他地方,然后使用您的网页会随心所欲地对待他们.为了避免浏览器自动添加指向它认为是电话号码的链接,请在文档的<head>中添加以下html标记(来自

If you're use case allows you to avoid using the tel: link format, you could put the numbers in something else that looks like a link and then have your webpage treat them however you wish. And to avoid having the browser auto-add links to numbers it thinks are telephone numbers, add the following html tag to your document's <head> (from the Safari Developer Library):

<meta name="format-detection" content="telephone=no">

这足够了吗?或者您还有其他我不明白的问题?

Is this sufficient or is there more to your question that I'm not understanding?

更新

需要进一步说明的是,似乎期望的结果是在按下tel://链接时调用本机电话拨号程序,而只是取消了拨号之前的用户提示.

With further clarification, it appears the desired result is to call up the native telephone dialer when a tel:// link is pressed, but simply suppress the user prompt that precedes the dialing.

根据 RFC 3966:电话号码的tel URI ,第11部分安全注意事项:
"Web客户端和类似工具一定不能使用" tel" URI来放置 未经用户明确同意的电话 客户.在没有适当用户的情况下自动拨打电话 确认可能会带来许多风险..."

According to RFC 3966: The tel URI for Telephone Numbers, Section 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..."

因此,尽管仍然有可能存在抑制警报的参数,例如&confirmation=false&alert=no,但对于每个移动OS,它可能是未记录的且有所不同.我的猜测是它不存在.

So while it still may be possible that a parameter exists to suppress the alert, such as &confirmation=false or &alert=no, it is likely undocumented and different for each mobile OS. My guess would be that it doesn't exist.

可能的解决方法

根据 iOS开发人员库:
"当用户点击网页中的电话链接时,iOS会显示一条警报,询问用户是否真的要拨打电话号码,并在用户接受的情况下启动拨号.当用户使用tel方案打开URL时在本机应用程序中,iOS不会显示警报,并且会在不进一步提示用户的情况下启动拨号.但是,可以将本机应用程序配置为显示其自己的警报."

因此,如果您的用例允许您将网站嵌入UIWebView中并将其作为iOS应用程序分发,则应该可以消除警报.

So if your use case allows you to embed the website in a UIWebView and distribute it as an iOS app, suppressing the alert should be possible.

根据 Android开发人员文档:
"[使用Dialer]要求您的应用程序在清单中请求以下权限:<uses-permission id="android.permission.CALL_PHONE" />"

According to the Android Developer Docs:
"[Use of the Dialer] requires your application to request the following permission in your manifest: <uses-permission id="android.permission.CALL_PHONE" />"

同样,如果您的用例允许您将网站嵌入到android.webkit.WebView中,并将其作为Android应用程序分发,则似乎也有可能取消警报.

So again, if your use case allows you to embed the website in an android.webkit.WebView and distribute it as an Android app, suppressing the alert appears to also be possible.

这篇关于单击tel:链接时禁止显示本机对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆