JS判断设备-检查手机系统-检测系统

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){
if(window.location.href.indexOf("?mobile")<0){
try{
if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
window.location.href="../m/index.html";
}else if(/iPad/i.test(navigator.userAgent)){
//ipad
}else{
// 其他
}
}catch(e){}
}
}


function getPgjs(){
var agent = navigator.userAgent.toLowerCase();
var res = agent.match(/android/);
if(res == "android")
return res;
res = agent.match(/iphone/);
if(res == "iphone")
return "ios";
res = agent.match(/ipad/);
if(res == "ipad")
return "ios";
res = agent.match(/windows/);
if(res == "windows")
return "wp";
return "pc";
}
0%