判断手机端获取哪种类型的手机系统-安卓-ios <!-- 第一种方法跳转 --> <script language="javascript"> var ua = navigator.userAgent.toLowerCase(); if (/iphone|ipad|ipod/.test(ua)) { //alert("iphone"); window.location.href = "http://www.runoob.com/js/js-popup.html"; } else if (/android/.test(ua)) { window.location.href = "https://www.baidu.com/"; // alert("android"); } </script> <!-- 第二种方法跳转 --> <script> var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; return { android: u.indexOf("Android") > -1 || u.indexOf("Linux") > -1, iPhone: u.indexOf("iPhone") > -1, iPad: u.indexOf("iPad") > -1, iPod: u.indexOf("iPod") > -1, }; }(), language: (navigator.browserLanguage || navigator.language).toLowerCase() } if (browser.versions.iPhone || browser.versions.iPad || browser.versions.iPod) { // alert("苹果") window.location.href = "http://www.runoob.com/js/js-popup.html"; } else if (browser.versions.android) { // alert("安卓") window.location.href = "https://www.baidu.com/"; } </script>