萬盛學電腦網

 萬盛學電腦網 >> 腳本專題 >> javascript >> js檢查手機訪問進行手機網站代碼

js檢查手機訪問進行手機網站代碼

   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://www.3lian.net/";

  }else if(/iPad/i.test(navigator.userAgent)){

  }else{

  window.location.href="http://www.3lian.net/phper/php.html"

  }

  }catch(e){}

  }

  }

copyright © 萬盛學電腦網 all rights reserved