1、是否是在微信中打开
isWeiXin: function () {
var ua = window.navigator.userAgent.toLowerCase();
if((/MicroMessenger/i).test(ua)){
return true;
}else{
return false;
}
}
2、是否是在IOS中打开
isIos: function () {
var agent = navigator.userAgent;
var isiOS = !!agent.match(/iPhone|mac|iPod|iPad|ios/i);
return isiOS
}
3、是否是在PC端打开
isPc: function () {
var plat = navigator.platform;
var win = plat.indexOf("Win") == 0;
var mac = plat.indexOf("Mac") == 0;
if (win || mac) {
return true
} else {
return false
}
}