微信:
Mozilla/5.0 (Linux; Android 8.1.0; vivo X21A Build/OPM1.171019.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 XWEB/880 MMWEBSDK/190301 Mobile Safari/537.36 MMWEBID/15 MicroMessenger/7.0.4.1420(0x2700043C) Process/toolsmp NetType/WIFI Language/zh_CN
qq:
Mozilla/5.0 (Linux; Android 8.1.0; vivo X21A Build/OPM1.171019.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044704 Mobile Safari/537.36 V1_AND_SQ_8.0.7_1204_YYB_D QQ/8.0.7.4085 NetType/WIFI WebP/0.3.0 Pixel/1080 StatusBarHeight/84
支付宝:
Mozilla/5.0 (Linux; U; Android 6.0.1; zh-CN; C106-8 Build/ZDXCNCM5601409252S) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.3.8.909 UCBS/[图片上传失败...(image-87a55e-1510801415890)]2.10.0.5 Mobile Safari/537.36 Nebula AlipayDefined(nt:NotReachable,ws:411|731|2.625null) AliApp(AP/10.0.5.022801) AlipayClient/10.0.5.022801 Language/zh-Hans useStatusBar/true
判断方法:
function isInternalBrowser() {
const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return "weixin";
} else if (ua.indexOf(' qq') != -1 && ua.indexOf('mqqbrowser') != -1) {
return "QQ";
} else if (ua.match(/Alipay/i) == "alipay") {
return "alipay";
}
return false;
}