//一
let agent = navigator.userAgent.toLowerCase();
let android = agent.indexOf("android");
let iphone = agent.indexOf("iphone");
let ipad = agent.indexOf("ipad");
if (android != -1) {
console.log('android')
}
if (iphone != -1 || ipad != -1) {
console.log('ios')
}
//二
let u = navigator.userAgent;
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
js判断是手机是android还是ios
最新推荐文章于 2021-04-07 23:38:57 发布