2012-06-09 87 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’); 
}