js判断是win系统还是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();
大家可以自己尝试一下啊

本文提供了一段JavaScript代码,用于判断当前运行环境的操作系统类型,包括Windows 32位、Windows 64位和Mac系统。通过分析navigator.userAgent属性,实现对不同操作系统的识别。
2571

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



