function IsPC() {
var userAgentInfo = navigator.userAgent
var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone",
"iPad", "iPod"]
var flag = true
for (var v = 0v <Agents.lengthv++) {
if (userAgentInfo.indexOf(Agents[v]) >0) {
flag = false
break
}
}
return flag
}
var flag = IsPC()//true为PC端,false为手机端
alert(flag)
<script type=”text/javascript”><!— //平台、设备和操作系统var system ={win : false,mac : false,xll : false}//检测平台var p = navigator.platformsystem.win = p.indexOf(“Win”) == 0system.mac = p.indexOf(“Mac”) == 0system.x11 = (p == “X11”) (p.indexOf(“Linux”) == 0)//跳转语句if(system.winsystem.macsystem.xll){}else{window.location.href=”android.aspx”}—></script>