首页 > 代码库 > JS判断是IOS还是Android

JS判断是IOS还是Android

var u = navigator.userAgent, app = navigator.appVersion;var isAndroid = u.indexOf(‘Android‘) > -1 || u.indexOf(‘Linux‘) > -1; //android终端或者uc浏览器var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端alert(‘是否是Android:‘+isAndroid);alert(‘是否是iOS:‘+isiOS);

JS判断是IOS还是Android