标签:useragent agent pre nav class oid mac os indexof mat
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终端
alert(‘是否是Android:‘+isAndroid);
alert(‘是否是iOS:‘+isiOS);
标签:useragent agent pre nav class oid mac os indexof mat
原文地址:http://www.cnblogs.com/yangfan5157/p/6244717.html