凉风有信,秋月无边
亏我思娇的情绪、好比度日如年
共 2 篇文章

标签:js判断

JS判断地区跳转代码

<script src='https://pv.sohu.com/cityjson?ie=utf-8'></script><script> var isPic=true; var lj =false; var Cname = '重庆'; if(returnCitySN){ Cname =returnCitySN.cname; } if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { isPic =false; console.log(Cname); if(Cname.indexOf('北京')>-1){ lj =true; } } if(isPic || lj){ is_tmp= 1; console.log('404'); $(function(){ $('title').html('404 Not Found'); $('body').load('/404.html'); }); } </script>  

赞(0)villainvillain技术笔记 阅读(33)去评论

js判断移动端跳转代码(替换www为m)方法

if(window!=top){top.location.href=_window.location.href;} var shouji = navigator.userAgent.match(/Android|iPad|iPhone|iPod/i) != null; var url = _window.location.href; var host = _window.location.host; if(shouji){ if(url.indexOf('//www.') > -1){ var wwwurl = url.replace("//www.","//m."); location.href= wwwurl; } }else{ if(url.indexOf('//m.') > -1){ var wwwurl = url.replace("//m.","//www."); location.href= wwwurl; } }  

赞(0)villainvillain技术笔记 阅读(37)去评论