首页 > 代码库 > js判断是iOS还是Android

js判断是iOS还是Android

1 <script type="text/javascript">2 var ua = navigator.userAgent.toLowerCase();    3 if (/iphone|ipad|ipod/.test(ua)) {4 //alert("iphone");        5 } else if (/android/.test(ua)) {6 //alert("Android");7 }8 </script>

 

js判断是iOS还是Android