问题描述
有两种方法可以在HTML中使用点击通话链接
There are two ways to have click-to-call links in HTML
-
< a href =wtai:// wp / mc; + 1800229933< / a>
WTAI风格(诺基亚,其他)
<a href="wtai://wp/mc;+1800229933</a>
WTAI style (Nokia, others)
< a href =tel:+ 1-800-275-2273>致电Apple客户支持部门,电话号码为1-800-275-2273< / a>。
电话风格(Apple)
<a href="tel:+1-800-275-2273">Call Apple Customer Support at 1-800-275-2273</a>.
TEL style (Apple)
如何
-
检测Javascript中当前用户代理支持哪种格式?
detect which format is supported by current user agent in Javascript?
是否可以在不依赖用户的情况下进行检测代理字符串
Is it possible to do the detection without relying the user agent string
更多信息
推荐答案
Max Firtman在。他表示,几乎所有移动设备都支持 tel:
协议,包括:iOS上的Safari,Android浏览器,webOS浏览器,Symbian浏览器,Internet Explorer,Opera Mini和低 - 终端设备浏览器。
Max Firtman has a great article on how to create click-to-call links for mobile browsers. He states that the tel:
protocol is supported by almost every mobile device, including: Safari on iOS, Android Browser, webOS Browser, Symbian browser, Internet Explorer, Opera Mini and low-end devices browsers.
由于 tel:
协议的广泛支持,我建议只使用 tel:
协议。为了支持诺基亚,我会检查包含诺基亚足迹。如果是这样,请将 tel:
替换为 wtai:// wp / mc;
Because of the wide support of the tel:
protocol, I would suggest just use the tel:
protocol. To support Nokia I would check if the navigator.userAgent
contains Nokia footprint. If so, replace tel:
to wtai://wp/mc;
如果你可以使用jQuery,Javascript可能类似于:
If you can use jQuery, the Javascript could look something like:
if (/(Series60|Nokia)/i.test(navigator.userAgent)){
$("a[href^='tel:']").each(function(){
this.href = this.href.replace("tel:", "wtai://wp/mc;");
});
}
这篇关于检测HTML< a> Javascript中的点击通话支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!