function validataOS(){
if(navigator.userAgent.indexOf("Window")>0){
return "Windows";
}else if(navigator.userAgent.indexOf("Mac OS X")>0) {
return "Mac ";
}else if(navigator.userAgent.indexOf("Linux")>0) {
return "Linux";
}else{
return "NUll";
}
}
/*如果需要知道操作系统的版本可以截取(navigator.userAgent)这个对象来判断
以windows为例
Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11*/
//红色部分就是系统版本
window系统版本所属操作系统看http://javaeedevelop.iteye.com/admin/blogs/1407802
310

被折叠的 条评论
为什么被折叠?



