cordova(ex phonegap)tel: not working in ios5中的链接

问题描述 投票:5回答:3

我已经在stackoverflow,谷歌,phonegap和其他网站到处检查,但我找不到解决方案,但如果我确实错过了正确的链接,请发给我,因为我迷路了。

1:我正在使用Cordova + JQmobi来编写我的应用程序。 2:唯一不起作用的链接是TEL:在标签链接中。 3:他们在Safari for ios中工作(我从ios4到ios5.1找到的任何版本)4:只在ios5中指向TEL的链接:在本机应用程序中不起作用

这里是我试过的代码:

<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>

对于我用过的电话号码的格式:电话:+39000000(+39是意大利)电话:123456(我尝试过任何类型的真实电话号码,但我没有#,*或空格)电话:/ / + 39123456

当我在xCode模拟器上检查SMS:链接时,我收到此错误:AppDelegate :: shouldStartLoadWithRequest:收到未处理的URL短信:+39123456

这是正确的,因为模拟器没有SMS应用程序,但是当我尝试TEL:链接:无法加载网页时出错:URL无法显示

如果你写一个你想用浏览器打开的非法律网址,就会发生这种情况。

我已经读过jqmobi(和jqtouch等其他框架一样多)可以阻止链接的默认行为但是如果你明确地调用它的话。

ios5真正改变了什么?因为我的所有链接都适用于ios4.3

那里的任何人请帮助我和我看到的许多其他人找不到这个Apple新版本的真正解决方案。

谢谢大家

ios5 hyperlink cordova jqmobi
3个回答
2
投票

我的解决方案是:没有解决方案。但是一个插件:https://github.com/mchristie/PhoneGap-ios-PhoneDialer/

如果您使用cordova,请务必检查您需要更改的4行(cordova而不是phonegap)


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’);
}

附录......有人建议编辑我将'.phone-number'改为'.phone'并删除'location = yes'。我不知道这会对这段代码产生什么影响,因为我不再处理这个项目了,代码是我拥有的回购,但是我可以告诉你某些改变.phone-number只是.phone会绝对不行,因为那不是我在输入字段中所谓的类。至于location = yes被删除,我再也不知道会有什么影响因为我不再有代码了。然而他们指出我使用了不正确的左右引号。这可能只是我的错误,但谁知道。


0
投票

你试过删除'+'吗?

<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>

从他们的规范来看,听起来他们并不完全支持所有特殊字符: http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/PhoneLinks.html

© www.soinside.com 2019 - 2024. All rights reserved.