判断当前是PC终端还是移动终端来跳转不同的路径(来自腾讯)

<script type="text/javascript">
    //判断当前是PC终端还是移动终端来跳转不同的路径
    var mobileUrl = "http://xw.qq.com/m/beijing/";
    if (/iphone|nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|wap|android|iPod/i.test(navigator.userAgent.toLowerCase())) {
        if (mobileUrl) {
            document.location.href = mobileUrl;
        }
    }
</script>

 

posted @ 2016-07-20 18:10  HALEY168  阅读(395)  评论(0编辑  收藏  举报