Cordova iOS <a href="mailto:" and="" <a="" href="tel:" only="" working="" on="" long="" press=""

时间:2016-11-09 10:41:20

标签: html ios xcode cordova mailto

="" I have two simple links in my app:

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

And none of them works when clicked, only when long pressed. They work fine when clicked on Android, Safari browser and when building and running the app in XCode to a device. However it does NOT work after uploading the app to "Test Flight". I find this very strange...

In my config file I have added access origins:

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

My version of Cordova is 6.1.0

And as mentioned it's only in test flight it's not responding on click event, I haven't published to prod(app store) because I have to be 100% sure this functionality works. Any one else having this problem ?

The current version in app store works just fine, this version was published a month ago.

Can it be that Apple has set restriction for this functionality, because someone misused the "tel:" to auto dial 911, and haven't informed developers about it ?

1 个答案:

答案 0 :(得分:4)

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

<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);"