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); if(isAndroid) { document.getElementById('myAnchor').innerHTML = "安卓手机"; } else if(isiOS) { document.getElementById('myAnchor').innerHTML = "IOS手机"; } else { document.getElementById('myAnchor').innerHTML = "都不是"; }
标签:isiOS,ios,innerHTML,js,myAnchor,var,android,document From: https://www.cnblogs.com/Jishuyang/p/16788663.html