js判断是PC端还是移动端

var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone",
"iPad", "iPod"];
var widowflag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
widowflag = false;
break;
}
}
if(widowflag){
}else{
}

转载于:https://my.oschina.net/u/3407708/blog/3060517

你可能感兴趣的:(js判断是PC端还是移动端)