判断手机还是pc

if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
    window.location.href = "https://www.baidu.com/";
} else {
  //pc window.location.href = "http://news.baidu.com/"; }
posted @ 2017-11-24 09:13  我是前端QQ942031558  阅读(123)  评论(0编辑  收藏  举报