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

580 阅读1分钟

image.png isMac: function(){ 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系统"); } }, 转载于: www.cnblogs.com/tingtaishou…