Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 606
Ionel Lupu Avatar asked Oct 24 '14 10:10

Ionel Lupu


2 Answers

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.

like image 127
cmarcelk Avatar answered Oct 16 '22 07:10

cmarcelk


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.

like image 29
LeftyX Avatar answered Oct 16 '22 07:10

LeftyX