再分享一段js判断浏览器操作系统的代码vista,xp,win7,win8,winServer

分类:Javascript| 发布:佚名| 查看: | 发表时间:2014/5/6

var version = navigator.appVersion.toLowerCase();
if (version.indexOf('win') -1) {
if (version.indexOf('nt 5.1') -1) {
this.browserOS = Windows XP;
}
else if (version.indexOf('nt 5.2') -1) {
this.browserOS = Windows Server;
}
else if (version.indexOf('nt 6.0') -1) {
this.browserOS = Windows Vista;
}
else if (version.indexOf('nt 6.1') -1) {
this.browserOS = Windows 7;
}
else if (version.indexOf('nt 6.2') -1) {
this.browserOS = Windows 8;
}
else {
this.browserOS = navigator.appVersion;
}
}
else if (version.indexOf('mac') -1) {
this.browserOS = Mac OS X;
}
else if (version.indexOf('unix') -1) {
this.browserOS = UNIX;
}
else if (version.indexOf('linux') -1) {
this.browserOS = Linux;
}
else {
this.browserOS = navigator.appVersion;
}

365据说看到好文章不转的人,服务器容易宕机
原创文章如转载,请注明:转载自郑州网建-前端开发 http://camnpr.com/
本文链接:http://camnpr.com/archives/1036.html