我使用PhoneGap编写了一个应用程序。
我从服务器接收到电话号码列表。 当列表中的某个项目被点击时,控制器会触发此函数:
$scope.call = function(number){
document.location.href = 'tel:' + number;
}
在iPhone上没问题,但是在Android上我遇到以下问题:
unsafe:tel:+97235726333
为什么?是UTF-8编码的问题吗?
我使用PhoneGap编写了一个应用程序。
我从服务器接收到电话号码列表。 当列表中的某个项目被点击时,控制器会触发此函数:
$scope.call = function(number){
document.location.href = 'tel:' + number;
}
在iPhone上没问题,但是在Android上我遇到以下问题:
unsafe:tel:+97235726333
一些系统不考虑加号,我知道以前在旧项目中遇到过这样的问题。你可以做的一件事是用00替换+,两个零相当于一个加号,这样就成为了一个完整的整数,没有+,这可能是内部解析器的问题。
$scope.call = function(number){
document.location.href = 'tel:' + number.replace("+","00");
}
tel:
href属性数据绑定?Angular使用协议白名单,并会在任何使用未列入白名单的协议的URL前添加unsafe:
。了解更多详情,请查看此处:https://dev59.com/fWUo5IYBdhLWcg3w_DpK - Adrien Delessert