WEB开发网
开发学院网页设计JavaScript 用Js判断客户端是PC还是手持设备 阅读

用Js判断客户端是PC还是手持设备

 2012-11-22 14:50:21 来源:WEB开发网   
核心提示: function IsPC() { var userAgentInfo = navigator.userAgent; var Agents = new Array("Android", "iPhone", "SymbianOS", "Wind

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

Tags:Js 判断 客户端

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接