判断手机端,PC端不同跳转

 

 

1. wap端打开pc端地址,强制跳转到wap地址

var ua = window.navigator.userAgent.toLowerCase();
if (!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))) {
window.location.href = "http://" + window.location.host+"/list";
}

 

2. pc端打开wap端地址,强制跳转到pc端地址

var ua = window.navigator.userAgent.toLowerCase();
if (ua.indexOf("iphone") > 0 || ua.indexOf("android") > 0) {
window.location.href = "http://" + window.location.host + "/wap/list";
}

  

 

posted @ 2016-05-21 16:53  fss_0214  阅读(332)  评论(0)    收藏  举报