html - Cordova iOS <a href ="mailto:"和 <a href ="tel:"仅适用于长按

标签 html ios xcode cordova mailto

我的应用程序中有两个简单的链接:

<a href="tel:00000000">Call 00000000</a>

<a href="mailto:service@xxx.com?subject=xxx"><i class="icon-envelope"></i><span data-string="email">Email</span></a>

点击时它们都不起作用,只有长按时才会起作用。 在 Android、Safari 浏览器上单击时以及在 XCode 中构建应用程序并将其运行到设备时,它们工作正常。 但是在将应用程序上传到“试飞”后它不起作用。我觉得这很奇怪......

在我的配置文件中,我添加了访问源:

    <access origin="*" />
    <access origin="tel:*" launch-external="yes" />
    <access origin="geo:*" launch-external="yes" />
    <access origin="mailto:*" launch-external="yes" />
    <access origin="sms:*" launch-external="yes" />
    <access origin="market:*" launch-external="yes" />

我的 Cordova 版本是 6.1.0

并且如前所述,它仅在试飞中不响应点击事件,我还没有发布到产品(应用程序商店),因为我必须 100% 确定此功能有效。还有其他人有这个问题吗?

应用商店中的当前版本运行良好,该版本是一个月前发布的。

会不会是苹果对这个功能设置了限制,因为有人滥用"tel:"来自动调用911,而且还没有通知开发者?

最佳答案

我花了一些时间才弄清楚这个“问题,但这对我有用:

<a href="#" onclick="window.open('tel:00000000', '_system'); return false;">Call 00000000</a>

我也试过 window.location = "tel:00000000"但这没有用。

所以现在我想我必须使用 window.open('tel:xxxxxxxx', '_system')

顺便说一句,如果你不想从当前页面设置 href 为 ->

href="javascript:void(0);"

关于html - Cordova iOS <a href ="mailto:"和 <a href ="tel:"仅适用于长按,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40505003/

相关文章:

ios -/Applications/Xcode.app/Contents/Developer/usr/bin/ibtool 失败,退出代码为 255

iphone - Xcode 无法在设备上调试

html - 向下滚动时 div 的高度不起作用

CSS 居中图像,带有带线条的动态左右 div

ios - Xamarin 单元测试不会加载到模拟器或手机 : "Cannot register two managed types ... with the same native name (' AppDelegate').“

ios - NSTimeZone.localTimeZone().secondsFromGMT 崩溃

ios - 具有多个 GUI 的 Xcode iOS 应用程序

javascript - 使用 jQuery 动画化元素

Java - 在 Jframe 中显示网页

ios - 如何在 iOS 的众多 CALayer 上高效绘制阴影?