首页 新闻 搜索 专区 学院

如何成功调起本地APP 应用

0
悬赏园豆:10 [待解决问题]

目前接到一个项目,需求 用到网页端 调起APP ,但是只有部分浏览器器支持,也只有部分的机型支持。如果更多的兼容 机型代码 如下


var get_appdown_conf=function(conf) {
var openAppUrl = "wbmain://nativejump?pagetype=main";
var appdown = conf['container'];
if(!(appdown instanceof HTMLElement)){
return false;
}
function getWlsour(regExp){
var tempWlsour = "oth";
var ua = navigator.userAgent.toLocaleLowerCase();
for(key in regExp){
if(regExp[key].test(ua)){
tempWlsour = key;
break;
}
}
return tempWlsour;
}
var regExp = {
weixin:/micromessenger\//ig,
momo : /momowebview\//ig,
qq : /mqqbrowser\/|\sqq\//ig,
baidu : /baidu/ig,
uc : /ucbrowser/ig,
xiaomi : /xiaomi\//ig,
firefox : /firefox/ig,
opera : /opr\/|opera/ig,
sogou : /sogoumobilebrowser/ig,
liebao : /liebao/ig,
oppo : /oppobrowser/ig,
360 : /360 aphone browser/ig,
//判断完其他的内容后再判断是否为safari
safari : /version\/([0-9]+\.\d[\.\d]*)\s+mobile\/\w+\s+safari\/([0-9]+\.\d[\.\d]*)/ig,
chrome : /chrome\/([0-9]+\.\d[\.\d]*)+\s+mobile\s+safari\/([0-9]+\.\d[\.\d]*)$|crios/ig
}
var objPara = {
pid:appdown.getAttribute('data-pid'),
wlmode:"sc",
wltype:(conf['wltype'] ? conf['wltype'] : 'bro'),
wlsour:(conf['wlsour'] ? conf['wlsour'] : getWlsour(regExp))
};
var arrPara = [];
for(var k in objPara){
if(objPara[k]){
arrPara.push(k+'=' + objPara[k]);
}
}
var strPara = arrPara.join('&');
openAppUrl += (strPara ? '&' + strPara : '');

var jumpUrl = appdown.getAttribute('data-jumpUrl');
var tongjitag = appdown.getAttribute('tongji_tag');
var conf = {
ios: {
openAppUrl: openAppUrl, //ios打开app的url,
jumpUrl: jumpUrl, //ios下载app的url,奥林匹亚放中间页的url
clickLog: tongjitag + '_' + 'ios'
},
andr: {
openAppUrl: openAppUrl, //android打开app的url,
jumpUrl: jumpUrl, //android下载app的url,奥林匹亚放中间页的url
clickLog: tongjitag + '_' + 'andr' //android点击发送的统计参数
}
};

return conf;
}

APP
桃子&阿狸的主页 桃子&阿狸 | 初学一级 | 园豆:192
提问于:2015-12-23 20:51
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册