JS 判断设备iOS、Android、Web
作者:互联网
const isDevice = function() { // 判断是android还是ios还是web
var ua = navigator.userAgent.toLowerCase()
if (ua.match(/iPhone\sOS/i) === 'iphone os' || ua.match(/iPad/i) === 'ipad') { // ios
return 'iOS'
}
if (ua.match(/Android/i) === 'android') {
return 'Android'
}
return 'Web'
}
标签:Web,return,iOS,JS,Android,ua,android,match 来源: https://www.cnblogs.com/ziliang/p/15739249.html