js判断设备是ios还是android
作者:互联网
function deviceType(){ var u = navigator.userAgent, app = navigator.appVersion; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 if (isAndroid) { return 2; } if (isIOS) { return 1; } }
标签:isIOS,return,indexOf,ios,js,var,android,navigator 来源: https://www.cnblogs.com/azure-zero/p/13724752.html