phonegap 跳转短信、邮件、拨号等功能
安装插件:cordova plugin add org.apache.cordova.inappbrowser
js调用代码:
短信:sms:[手机号]?body=[短信内容] 注意内容编码:如果短信内容中包含“%”,需要使用encodeURI()进行编码
var url = 'sms:?body='+c.data.content.text; var browser = window.open(url,'_blank','hidden=yes'); browser.addEventListener('loadend', function(event) { browser.close(); });
邮件:mailto:[主送]?subject=[邮件标题]&body=[邮件内容]
var url = 'mailto:[email protected]?subject='+c.data.content.subject+'&body='+c.data.content.text; var browser = window.open(url,'_blank','hidden=yes'); browser.addEventListener('loadend', function(event) { browser.close(); });
拨号:tel:[电话号码]
var url = 'tel:xxxxxx'; //xxx为电话号码 var browser = window.open(url,'_blank','hidden=yes'); browser.addEventListener('loadend', function(event) { browser.close(); });
相关推荐
86193952 2020-10-27
小木兮子 2020-11-11
HeyShHeyou 2020-11-17
seanzed 2020-10-15
huangliuyu00 2020-09-24
libaoshan 2020-09-11
zhangpan 2020-09-10
chongxiaocheng 2020-08-16
xcguoyu 2020-08-15
Qizonghui 2020-08-02
ldcwang 2020-07-26
mqfcu 2020-07-21
jeason 2020-07-20
sunzhihaofuture 2020-07-19
knightwatch 2020-07-19
点滴技术生活 2020-07-19
Reiki 2020-07-06