建站教学网,让你建站更便捷和轻松!QQ交流群:78085540
您当前的位置:首页 > 网页制作 > Javascript/Ajax

js手机打开网站跳转到手机wap的代码

来源:  时间:2017-07-09 19:18:18

 var nowurl=window.location.href;

nowurl=nowurl.replace("www.jzread.com","m.jzread.com");
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("?agent=m")<0){
try{
if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
window.location.href=nowurl;
}else if(/iPad/i.test(navigator.userAgent)){
}else{
window.location.href=nowurl;
}
}catch(e){}
}
}
 

责任编辑:

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
CopyRight 2008-2009, JZREAD.COM, Inc. All Rights Reserved 联系QQ:568245346
皖ICP备09015033号