Ionel Lupu
Ionel Lupu

Reputation: 2801

Mobile phone call or mailto doesn't work at all

I have a really small app:

<!DOCTYPE html>
<html>
<head>
   <title></title>
</head>

<body>
    <a href="mailto:[email protected]">Send Mail</a>
    <a href="tel: +18543458975">Call</a>

    <button onclick="document.location.href = 'tel:+1-800-555-1234'">Click me</button>
    <button onclick="document.location.href = 'tel:+18543458975'">Click again</button>
</body>
</html>

When I build and run it the links doesn't work at all.

Two weeks ago (on another app) this worked perfectly but now it doesn't work on this neither my older apps.

I ran out of ideas!

What is is happening?

Upvotes: 5

Views: 11263

Answers (3)

LeftyX
LeftyX

Reputation: 35587

I guess things have changed again with the new release.

You must install the cordova plugin whitelist:

cordova plugin add cordova-plugin-whitelist

or if you want to save the reference to your config.xml file:

cordova plugin add cordova-plugin-whitelist --save

and that you have to add the intent to your config.xml file:

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

You can find more info here.

Upvotes: 14

cmarcelk
cmarcelk

Reputation: 306

Using protocols other than http/https is now whitelisted, and blocked by default.

http://cordova.apache.org/announcements/2014/08/04/android-351.html http://cordova.apache.org/announcements/2014/09/08/cordova-361.html

You simply need to add mailto and tel protocols to the whitelist.

See the "External Application Whitelist" section of http://cordova.apache.org/docs/en/edge/guide_appdev_whitelist_index.md.html for instructions on what to add to the whitelist starting in 3.6.0.

Because the security vulnerability surrounding this was fixed in 3.5.1, you don't want to use 3.5.0 or you'll be vulnerable and get a warning from the Google Play store.

Upvotes: 15

Ionel Lupu
Ionel Lupu

Reputation: 2801

I seemed that the bug was from cordova version 3.6 I was working on , so I installed an older version (3.5) and now it works perfectly!

Upvotes: 0

Related Questions