JS 判断电脑是 Win 还是 mac?
//判断系统类型
function OSnow() {
const agent = navigator.userAgent.toLowerCase()
const 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://juejin.cn/post/6854573221614714893