如何打开电话拨号器? [英] How to open the phone dialer?
问题描述
我试图在点击按钮和/或锚标签时在我的worklight 6.2混合应用程序中启动电话拨号程序。以下是我使用的代码。
I am trying to launch the phone dialer in my worklight 6.2 hybrid application when clicking on a button and/or an anchor tag. Below is the code I am using.
按钮:
<button onClick='window.parent.location.href = "tel:+1xxxx"'>Tel</button>
锚标签:
<a href='tel:+18001111111' class="ui-link">(800) 111-1111</a>
当我们点击button / anchor标签时,下面是Android和iOS中的行为。
在android:
When we click on button/anchor tag below is the behavior in android and iOS.
In android:
显示一个弹出窗口,其中显示消息
Displays a pop up window with the message
应用程式错误net :: ERR_UNKNOWN_URL_SCHEME(TEL:+18001111111)
Application Error net::ERR_UNKNOWN_URL_SCHEME (TEL:+18001111111)
在iOS中:
点击事件没有响应。
推荐答案
您是在iOS模拟器中测试吗?如果是的话,您必须在设备中测试。
对于Android,您可以在模拟器或设备中测试。
Are you testing in the iOS Simulator? if so, you must test in a device.
For Android, you can test in either the Emulator or a device.
我在iOS设备中:
-
< a href =tel:+ 1-800- 555-1234>调用此号码< / a>
可以直接从HTML调用
<a href="tel:+1-800-555-1234">call this number</a>
Can be invoked right from the HTML
document.location.href =tel:+375292771265;
可以通过按钮上的功能调用
document.location.href = "tel:+375292771265";
Can be invoked via a function on button tap
对于Android,
由于Cordova中的安全漏洞(以及针对它们的修复),为了让上述代码正常工作,您需要打开native\res\xml\config.xml并执行以下操作:
Due to security bugs in Cordova (and the fixes made to counter them), to get the above code to work, you need to open native\res\xml\config.xml and perform the following:
- <access origin="*"/>
+ <access origin="tel:*" launch-external="true"/>
这篇关于如何打开电话拨号器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!