jquery判断手机端或者pc端

<script>
    $(function(){
        if(navigator.userAgent.match(/mobile/i)) {
            alert('手机')
        }else {
           alert('pc')
        }
    });
</script>

 

posted @ 2020-03-16 19:08  原来是个帅小伙  阅读(1212)  评论(0编辑  收藏  举报