概述
本js是ulunwen网站开源的第一个api接口,支持原生态和html5的交互,支持app和web间的判断
使用方法
1)通过伪协议来进行原生态操作,具体使用方法见文档
var userAgent = navigator.userAgent; var terminal=""; if (userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1) {//安卓手机 terminal="0"; } else if (userAgent.indexOf('iPhone') > -1) {//苹果手机 terminal="1"; } else { }
上面是对移动设备的判断,然后使用方法如下,这里以一个支付函数为例子进行js交互
function gotoPaty(ddbh,pjXsj){ if(terminal=="1"){ window.location.href="/gotoPaty/"+ddbh+":"+pjXsj; }else{ window.android.clickSkip(ddbh,pjXsj);
}
demo下载
需要详细demo,请留下邮箱,站长会及时第一时间发送到你邮件中。
邮件格式请用如:myapp#qq.com 其中用#代替@