windowsVersion = userAgentInfor.substr(userAgentInfor.indexOf('windows nt ') + 11,4),
nameVersion;
switch(windowsVersion){
case '5.1':
nameVersion = 'window xp';
break;
case '6.1':
nameVersion = 'window 7';
break;
case '6.3':
nameVersion = 'window 8';
break;
case '10.0':
nameVersion = 'window 10';
break;
default:
nameVersion = '其他';
}
最后输出nameVersion ,就是常见的几个windows操作系统版本
也可以根据判断windowsVersion来输出不同的内容
var userAgentInfor = navigator.userAgent.toLowerCase(),windowsVersion = userAgentInfor.substr(userAgentInfor.indexOf('windows nt ') + 11,4),
nameVersion;
switch(windowsVersion){
case '5.1':
nameVersion = 'window xp';
break;
case '6.1':
nameVersion = 'window 7';
break;
case '6.3':
nameVersion = 'window 8';
break;
case '10.0':
nameVersion = 'window 10';
break;
default:
nameVersion = '其他';
}
最后输出nameVersion ,就是常见的几个windows操作系统版本
也可以根据判断windowsVersion来输出不同的内容