function deviceType() {
console.log('当前设备参数', navigator.userAgent)
let userAgent = navigator.userAgent
let agents = [
'Android',
'iPhone',
'SymbianOS',
'Windows Phone',
'iPad',
'iPod'
]
let nowAgent = ''
agents.forEach(item => {
if (userAgent.includes(item)) {
nowAgent = item
}
});
return nowAgent
}
console.log(deviceType())
写一个判断设备来源的方法
最新推荐文章于 2023-05-25 16:04:20 发布