js判断用户系统类型

function get_uset_os(){
//获取用户代理 
var ua = navigator.userAgent;
if (ua.indexOf("Windows NT 5.1") != -1){ 
alert("Windows XP");
}
if (ua.indexOf("Windows NT 6.0") != -1){ 
alert("Windows Vista");
}
if (ua.indexOf("Windows NT 6.1") != -1){ 
alert("Windows 7");
}
if (ua.indexOf("Windows NT 6.3") != -1){ 
alert("Windows 8");
}
if (ua.indexOf("Windows NT 10.0") != -1){ 
alert("Windows 10");
}
if (ua.indexOf("iPhone") != -1){ 
alert( "iPhone");
}
if (ua.indexOf("iPad") != -1){
alert("iPad");

if (ua.indexOf("Linux") != -1) { 
var index = ua.indexOf("Android"); 
if (index != -1) { 
//os以及版本 
var os = ua.slice(index, index+13); 

//手机型号 
var index2 = ua.indexOf("Build"); 
var type = ua.slice(index1+1, index2); 
alert(type + os); 
} else { 
alert("Linux"); 
}
}
}

你可能感兴趣的:(javascript,JAVA)