What's a reliable method for setting up telephone links for mobile browsers?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 17:16:21
Mick

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/

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:

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>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!