js判断电脑是windows系统还是mac系统


//判断系统类型
function OSnow(){
var agent = navigator.userAgent.toLowerCase();
var isMac = /macintosh|mac os x/i.test(navigator.userAgent);
if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
//your code
alert("这是windows32位系统");
}
if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
//your code
alert("这是windows64位系统");
}
if(isMac){
//your code
alert("这是mac系统");
}
}
OSnow();

原文地址:https://www.cnblogs.com/PoisonousMushrooms/p/15229902.html