uni-app 判断客户端环境是安卓还是ios
https://www.jianshu.com/p/a36d9e771b00
App、H5和微信小程序判断是安卓还是ios
switch(uni.getSystemInfoSync().platform){ case 'android': console.log('运行Android上') break; case 'ios': console.log('运行iOS上') break; default: console.log('运行在开发者工具上') break; }
注:在微信小程序开发工具中使用 uni.getSystemInfoSync().platform
返回值为 devtools
H5判断是安卓还是ios
//判断是安卓还是ios isAndroidOrIOS() { var u = navigator.userAgent; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端 var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 if (isAndroid) { return "1" } if (isiOS) { return "0" } }