boy*_*oyd 5 mobile html5 android cordova ionic-framework
我有一个非常小的应用程序:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<a href="mailto:someone@example.com">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>
Run Code Online (Sandbox Code Playgroud)
当我构建并运行它时,链接根本不起作用.
两个星期前(在另一个应用程序上)这个工作完美但现在它不适用于我的旧应用程序.
我的想法用完了!
发生了什么事?
小智 15
使用http/https以外的协议现已列入白名单,默认情况下已被阻止.
http://cordova.apache.org/announcements/2014/08/04/android-351.html http://cordova.apache.org/announcements/2014/09/08/cordova-361.html
您只需将mailto和tel协议添加到白名单.
有关从3.6.0开始添加到白名单的内容的说明,请参阅http://cordova.apache.org/docs/en/edge/guide_appdev_whitelist_index.md.html的"外部应用程序白名单"部分.
由于围绕此问题的安全漏洞已在3.5.1中得到修复,因此您不想使用3.5.0,否则您将容易受到攻击并从Google Play商店收到警告.
Lef*_*tyX 14
我想新版本的内容已经发生了变化.
您必须安装cordova插件白名单:
cordova plugin add cordova-plugin-whitelist
Run Code Online (Sandbox Code Playgroud)
或者如果要保存对config.xml文件的引用:
cordova plugin add cordova-plugin-whitelist --save
Run Code Online (Sandbox Code Playgroud)
并且您必须将意图添加到config.xml文件:
<allow-intent href="mailto:*" />
<allow-intent href="tel:*" />
Run Code Online (Sandbox Code Playgroud)
你可以在这里找到更多信息.
归档时间: |
|
查看次数: |
10650 次 |
最近记录: |