//isPC(): 检测客户端环境是否是pc端
function isPC(){
let userAgent = navigator.userAgent;
let agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
let ispc = true, v;
for(v = 0; v < agents.length; v++){
if (userAgent.indexOf(agents[v]) > 0){ispc = false; break;}
}
return ispc;
}
//调用
document.write(isPC());//true