JQ 判断 浏览器打开的设备类型

<script>
    $(document).ready(function(){
        var ua = navigator.userAgent;
        var ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
        isIphone = ua.match(/(iPhone\sOS)\s([\d_]+)/),
        isAndroid = ua.match(/(Android)\s+([\d.]+)/);
        if(isIphone!=null || isAndroid!=null || ipad!=null){
            //isIphone!=null  打开设备为Iphone
 } }); </script>

 

posted @ 2017-08-23 12:08  黑色白沙  阅读(271)  评论(0编辑  收藏  举报