首页 > 代码库 > 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))&&window.location.href.indexOf("?mobile")<0)try{/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)?window.location.href="http://m.zfnet.net":/iPad/i.test(navigator.userAgent)||(window.location.href="http://m.zfnet.net")}catch(e){}

  

js检测到如果是手机端就跳转到手机端的网址代码