Search code examples
ioscordovacordova-plugins

Why tel:* links don't work on ios?


I added this to config.xml

<access origin="*"/>
<access origin="tel:*" launch-external="yes"/>
<access origin="mailto:*" launch-external="yes"/>
<allow-intent href="*"/>
<allow-navigation href="*"/>
<allow-navigation href="tel:*"/>
<allow-navigation href="mailto:*"/>
<allow-navigation href="data:*"/>
<plugin name="cordova-plugin-whitelist" version="1" />

And this to index.html:

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

When I'm clicking to a link like that: <a href="tel:+1234567">Call!</a> nothing happens on the ios (on the android it works well).

If I change my config.xml to:

<access origin="//*"/>
<access origin="tel:*" launch-external="yes"/>
<access origin="mailto:*" launch-external="yes"/>
<allow-intent href="//*"/>
<allow-navigation href="//*"/>
<allow-navigation href="tel:*"/>
<allow-navigation href="mailto:*"/>
<allow-navigation href="data:*"/>
<plugin name="cordova-plugin-whitelist" version="1" />

It calls, but ajax requests to server stop working.


Solution

  • just remove allow-navigation

    <allow-navigation href="tel:*"/>
    <allow-navigation href="mailto:*"/>
    

    I don't why ,but it work!

    cordova-ios@4+wkwebview will get the navigation filter first to respond for the url,and do nothing!!

    https://github.com/apache/cordova-plugin-wkwebview-engine/pull/20