2012-06-09 90 views
4

I've checked everywhere here in stackoverflow, google, phonegap and other websites but I cannot find a solution, but if I did miss the right link, please post me to it, because I'm lost.cordova(ex phonegap)tel:链接在<a href> not working in ios5

1: I'm using Cordova + JQmobi to write my apps. 2: the only link that doesn't work is the TEL: in a tag links. 3: they work in Safari for ios (any version I've found from ios4 to ios5.1) 4: ONLY in ios5 the link to TEL: won't work in native apps

Here the codes I've tried:

<a href="tel:+39000000">Link to the tel</a> 
<a href="tel:+39000000" target="_blank">Link to the tel</a> 
<a href="tel:+39000000" target="_self">Link to the tel</a> 
<a href="" onclick="windows.location('tel:+39000000')" target="_blank">Link to the tel</a> 

For the format of the telephone number I've used: tel:+39000000 (+39 is for italy) tel:123456 (I've tried any kind of real telephone numbers but I have no #, * or spaces) tel://+39123456

When I check on the xCode simulator for a SMS: link i get this error: AppDelegate::shouldStartLoadWithRequest: Received Unhandled URL sms:+39123456

And that's correct because the simulator doesn't have the SMS app, but then when I try the TEL: link: Failed to load webpage with error: The URL can’t be shown

That for what I know is something that happens if you write a non legal url that you want to open with a browser.

I've read that jqmobi (as much as other framework such as jqtouch) could prevent the default behavior of a link but that if you explicitly invoke it.

What is really changed in the ios5? Because all my links work on the ios4.3

Anyone out there please help me and many other I saw couldn't find a real solution for this new update of Apple.

Thanks for all

回答

0

Have you tried removing the '+'?

<a href="tel:39000000">Link to the tel</a> 
<a href="tel:39000000" target="_blank">Link to the tel</a> 
<a href="tel:39000000" target="_self">Link to the tel</a> 
<a href="" onclick="windows.location('tel:39000000')" target="_blank">Link to the tel</a> 

as from their spec it sounds like they don't fully support all special characters:
http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/PhoneLinks.html

+0

哦,是的,我做了,我尝试过的第一件事:电话:1234567与当然真正的电话号码,它不工作,哦,我也用0039而不是+39和相同的结果,但我读过许多人有这种麻烦,所以看起来像一个科尔多瓦问题。我在ios4.3上忘记了以下格式: 电话:+391234567 电话:00391234567 电话:1234567 – regrunge

+0

尝试使用您的示例设置测试网页,并在Safari中将其打开以将问题隔离到Cordova。 – JonWarnerNet

+0

在Safari的代码工作,我没有得到任何错误 – regrunge

1

其实,有这种解决方案,或者至少有我,那就是:

在HTML:

<input type="button" href="tel:+1-800-555-1234“ class="phone-number" value="1-800-555-1234"/> 

在JavaScript:

$(‘.phone-number’).bind(click, function(e) { 
    e.preventDefault() 
    var phoneLink = $(e.currentTarget).attr('href'); 
    window.open(phoneLink, '_system', 'location=yes’); 
}