码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2016-07-20 19:31:27      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:

<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>

 

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

标签:

原文地址:http://www.cnblogs.com/haley168/p/toMobile.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!