通过获取浏览器的userAgent, 进行判断
var userAgent = navigator.userAgent.toLowerCase();
if(userAgent .match(/MicroMessenger/i)==”micromessenger”) {
alert("weixin");
}
if(userAgent .match(/android/i)) == "android") {
alert("android");
}
if(userAgent .match(/iPhone/i)) == "iPhone"){
alert("iPhone");
}
if(userAgent .match(/iPad/i)) == "iPad"){
alert("iPad");
}
网友评论