ios - Allow call (and maps, and mail) in cordova -


i've been struggling while. i'm trying make call after people press 'call' popup. funny thing is, goes straight calling when click phone number. when hit 'call', console returns:

error internal navigation rejected - <allow-navigation> not set url='tel:06-83237516

code:

controller:

$scope.callperson = function() {     var link = "tel:" + $scope.person.phonenumber;     var confirmtel = $ionicpopup.confirm({         title: $scope.person.phonenumber,         canceltext: 'cancel',         oktext: 'call'     });     confirmtel.then(function(res) {         if (res) {             window.open(link);         } else {             console.log('cancel call');         }     }); } 

config.xml:

<access origin="*"/> <allow-intent href="tel:*"/> <allow-intent href="mailto:*"/> <access origin="tel:*" launch-external="yes"/> <access origin="mailto:*" launch-external="yes"/> 

html:

<div ng-click="callperson()"> {{person.phonenumber}}</div>   

with mail, doesn't work @ all, , returns identical error. same opening maps. work in phonegap test app, not when deployed.

maps code:

$scope.openmaps = function() {     var address = $scope.person.adres + ", " + $scope.person.plaats;     var url = '';     if (ionic.platform === 'ios' || ionic.platform === 'iphone' || navigator.useragent.match(/(iphone|ipod|ipad)/)) {         url = "http://maps.apple.com/maps?q=" + encodeuricomponent(address);     } else if (navigator.useragent.match(/(android|blackberry|iemobile)/)) {         url = "geo:?q=" + encodeuricomponent(address);     } else {         url = "http://maps.google.com?q=" + encodeuricomponent(address);     }     window.open(url); }; 

may late want comment other users couldn't face issue. because didn't find working solution anywhere.

you need add <allow-navigation href="tel:*" /> in config.xml

i facing same issue mailto intent. working when tried directly

<a onclick="mailto:test@me.com">email</a> 

but got error when tried call using javascript window.location.href = 'mailto:test@me.com

internal navigation rejected - <allow-navigation> not set url='mailto:test@me.com'

all need add allow-navigation in config.xml

so config.xml be:

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

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -