/**
*判断当前的浏览器类型
*/
function terminalInfo() {
var jsons= {}
var ua = navigator.userAgent;
var isWeixin = !!/MicroMessenger/i.test(ua);
var isAplipay = !!/AlipayClient/i.test(ua);
var isUnionPay = !!/UnionPay/i.test(ua); //云闪付
//判断是否是微信访问
if(isWeixin){
jsons.appName = "WECHAT";
jsons.payChannel = "wxpay";
jsons.source = "WEB_WECHAT"
}else if(isAplipay){
jsons.appName = "ALIPAY";
jsons.payChannel = "ALIPAY";
jsons.source = "WEB_ALIPAY"
}else if(isUnionPay){
jsons.appName = "UNIONPAY";
jsons.payChannel = "UNIONPAY";
jsons.source = "WEB_UNIONPAY"
}else{
jsons.appName = "WEB";
jsons.source = "WEB";
}
return jsons;
}
来源:oschina
链接:https://my.oschina.net/u/914487/blog/4268266