为移动浏览器设置电话链接的可靠方法是什么?

发布于 2024-10-02 23:32:02 字数 333 浏览 0 评论 0原文

我正在开发一个适用于移动浏览器的快速页面。虽然手机(目标受众)上的浏览器之间几乎没有一致性,但我希望尽可能轻松地从用户的电话拨打一个电话号码。链接似乎是显而易见的选择;所以我设置了以下内容:

<a href="tel:+18881235467">1-888-123-5467</a>

这似乎可以在更高级的浏览器(例如 Android 和 Android 浏览器)上正常工作。黑莓浏览器,在其他手机上的可靠性要差很多。任何有关使此链接一致和/或正确工作的建议将不胜感激。

仅供参考,这是美国国内的免费电话,但我想某些设备可能正在寻找更通用的格式。

I'm working on a quick page intended for mobile browsers. While there is little consistency between browsers on cell phones (the target audience), I have a phone number that I would like to be as easy as possible to dial from the users phone. A link seems the obvious choice; so I set up the following:

<a href="tel:+18881235467">1-888-123-5467</a>

This seems to work OK on more advanced browsers such as the Android & BlackBerry browsers, it's a lot less reliable on other phones. Any advice on making this link work consistently and or correctly will be greatly appreciated.

FYI, this is a toll free domestic US call, but I imagine that some devices may be looking for a more general format.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心意如水 2024-10-09 23:32:02

您使用的方法是执行此操作的“标准”方法(即遵循 RFC 3966)。如果移动浏览器无法正确解释它,解决此问题的唯一明显方法是扩展或修改浏览器行为本身,您可能不想这样做或无权这样做。

我相信 Windows 设备(移动浏览器)、iPhone(safari)、Symbian 以及您所说的黑莓和 Android 都支持它。

您是否发现这些设备存在问题,或者您是否也支持其他手机?

请注意,其他人似乎在 iPhone 和 iPad 上遇到了相反的问题,因为默认浏览器 (Safari) 将任何看起来像电话号码的内容更改为链接:

http://www.darowski.com/tracesofinspiration/2009/03/31/stop- iphone-来自不正确的自动链接电话号码/

The approach you are using is the 'standard' way to do this (i.e follows RFC 3966). If a mobile browser does not interpret it correctly, the only obvious way to fix this would be to extend or modify the browsers behavior itself, which you probably do not want to do or have access to do.

I believe it is supported on Windows devices (mobile explorer), iPhone (safari), Symbian and from what you are saying Blackberry and Android.

Are you finding problems with theses devices or are you supporting other mobile phones also?

Note that others seem to be having the opposite problem with iPhone and iPad as the default browser (Safari) changes anything that looks like a phone number into a link:

http://www.darowski.com/tracesofinspiration/2009/03/31/stop-iphone-from-incorrectly-auto-linking-phone-numbers/

浅沫记忆 2024-10-09 23:32:02

我最终想出了一个像这样工作的链接:

<a href="wtai://wp/mc;18881235467">1-888-123-4567</a>

这适用于迄今为止测试的每部手机,包括 Android、黑莓和一些非常的旧手机。据我所知,链接的结构如下:

WTAI 引用无线电话应用程序接口。 wp/ 指的是 WTAPublic 函数。 MC;是 makeCall 函数,然后你当然就有电话号码了。同样,你可以做这样的链接:

<a href="wtai://wp/ap;18881235467">Add to addressbook: 1-888-123-4567</a>

This is the same except mc;已被 ap; 取代,它指的是 addPBEntry 函数。这会将电话号码添加到您的地址簿或类似的电话号码存储中。

这两个网站对我的研究很有帮助:

What I eventually came up with was a link that worked like this:

<a href="wtai://wp/mc;18881235467">1-888-123-4567</a>

This has worked on every phone tested so far, including Android, BlackBerry and some very clunky older phones. From what I gather, the structure of the link works like so:

WTAI references the Wireless Telephony Application Interface. The wp/ refers to the WTAPublic functions. The mc; is the makeCall function, and then of course you have the phone number. Similarly, you can do a link like this:

<a href="wtai://wp/ap;18881235467">Add to addressbook: 1-888-123-4567</a>

This is the same except mc; has been replaced by ap;, which refers to the addPBEntry function. This adds the phone number to your address book or similar stash of phone numbers.

These two sites were helpful in my research:

看海 2024-10-09 23:32:02

我见过像 yelp 这样的大网站使用不同的方法来实现这一点,他们使用 vcard 和 tel 类:

http:// /microformats.org/wiki/hcard

<div class="vcard">
    <span class="tel">(555) 555-5555</span>
</div>

I've seen big sites like yelp use a different method for accomplishing this, where they use vcard and tel classes:

http://microformats.org/wiki/hcard

<div class="vcard">
    <span class="tel">(555) 555-5555</span>
</div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文