您的位置:首页 > Web前端 > JavaScript

JS判断PC终端还是移动终端来跳转不同的路径

2016-07-12 00:00 555 查看
摘要: JS判断终端跳转不同路径

<script type="text/javascript">
//判断当前是PC终端还是移动终端来跳转不同的路径
var mobileUrl = "http://xxx.com/m/";
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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: