jquery判断手机端或者pc端

<script>
    $(function(){
        if(navigator.userAgent.match(/mobile/i)) {
            alert('手机')
        }else {
           alert('pc')
        }
    });
</script>
人生得意须尽欢,莫使金樽空对月.
原文地址:https://www.cnblogs.com/luojie-/p/12505894.html