js区分苹果浏览器和安卓浏览器 js判断手机浏览器种类
程序员文章站
2022-04-27 14:08:51
...
<script type="text/javascript"> jQuery(function($){ var $js_footer_top=$("#js_footer_top"); var $js_iphone=$("#js_iphone"); var $js_android=$("#js_android"); if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { if (document.cookie.indexOf("iphone_redirect=false") == -1) { $js_footer_top.show(); $js_iphone.show(); $js_android.hide(); } } var ua = navigator.userAgent.toLowerCase(); var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile"); if(isAndroid) { $js_footer_top.show(); $js_android.show(); $js_iphone.hide(); } }) </script>