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){}

  

posted @ 2017-05-04 11:33  绿尘枫  阅读(367)  评论(0编辑  收藏  举报