jquery根据请求的设备跳转到相应的页面

if(window.location.toString().indexOf('pref=padindex') != -1){
  }else{
  if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){
  if(window.location.href.indexOf("?mobile")<0){
  try{
  if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
  window.location.href="http://m.mobile.com/index.htm";
  }else if(/iPad/i.test(navigator.userAgent)){
  window.location.href="http://www.pad.com/index/"
  }else{
  window.location.href="http://m.mobile.com/simple/s/index/"
  }
  }catch(e){}
  }
  }
  }
posted @ 2015-05-01 08:51  徐本县  阅读(669)  评论(0编辑  收藏  举报