简体   繁体   English

通过单击移动网络浏览器上页面上的链接来发起呼叫

[英]initiate call by clicking link on a page on mobile web browser

I am working on project where on clicking a link the phone call gets initiated ,without any prompt from android or ios phones. 我正在研究一个项目,在该项目上,单击链接即会发起电话呼叫,而没有来自android或ios电话的任何提示。 I am trying to achieve this using angular using the below code but this isn't working: 我正在尝试使用下面的代码使用angular来实现此目的,但这不起作用:

<a class="button" ng-click="phonecallTab(Phonenumber)"></a>

and code: 和代码:

$scope.phonecallTab = function ( phonenumber ) {
    var call = "tel:" + phonenumber;
    alert('Calling ' + call ); //Alert notification is displayed on mobile, so function is triggered correctly!
    document.location.href = call;
}

I googled and found that the below should be added to the config.xml to achieve this, but as I am using apache and do not want an app, what should I do to achieve this? 我在Google上搜索后发现,应将以下内容添加到config.xml以实现此目的,但是由于我使用的是apache并不需要应用程序,我应该怎么做才能实现此目的? Where on clicking the link the call gets initiated without any confirm dialog as on IOS or landing on the dialer screen as in Android? 在单击链接时,如何在没有任何确认对话框(如IOS上)或登陆到拨号器屏幕(如Android)的情况下启动呼叫?

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

I think you can't. 我想你做不到 I would have put that alert check in the OS, and I think android and iOS does the same. 我本来可以将警报检查放入操作系统中,并且我认为android和iOS可以做到这一点。 I'm thinking of the UX to suddenly be calling someone without choosing it. 我想到的是UX突然打电话给某人而没有选择它。 But I might be wrong, like the meta tags or other can change that behavior. 但是我可能是错的,例如meta标签或其他可以改变这种行为。

Hi this is worked for me , check it once 嗨,这对我有用,请检查一次
In your HTML page 在您的HTML页面中

<a ng-click="callMobile(number)" href="#" >{{number}}</a>

In your controller the code will be 在您的控制器中,代码将是

$scope.callMobile = function(number){
    console.log('callMobile function got called');
    console.log('number: ' + number)
     window.open('tel:' + number, '_system');
  }

Reply back if you have any queries 如有任何疑问请回覆

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM