1 <script type="text/javascript" charset="utf-8"> 2 androdd() { 3 var u = navigator.userAgent; 4 var isAndroid = u.indexOf(‘Android‘) > -1 || u.indexOf(‘Adr‘) > -1; //Android 5 var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //iOS 6 // alert(‘是否是Android:‘ + isAndroid); 7 // alert(‘是否是iOS:‘ + isiOS); 8 if (isAndroid) 9 window.location.href = "http://XXXX.com/apks/hotel.apk" 10 else 11 window.location.href = "https://apps.apple.com/cn/app/XXXXXXXX" 12 } 13 </script>