评论

收藏

手机访问PC网站自动跳转到手机网站代码

avatar admin | 1019 人阅读 | 0 人评论 | 2018-01-17

一种比较简单的JS代码,测试可以的
[pre]<script type="text/javascript">
var noRedirect = location.search.split('noRedirect=')[1]
if((noRedirect == null) || noRedirect.toString() != 'true') {
if(navigator.userAgent.match(/Android/i)
||
navigator.userAgent.match(/webOS/i)
||
navigator.userAgent.match(/iPhone/i)
||
navigator.userAgent.match(/iPad/i)
||
navigator.userAgent.match(/iPod/i)
||
navigator.userAgent.match(/BlackBerry/i)
||
navigator.userAgent.match(/Windows Phone/i)
)
{
location.href = 'http://www.eazhijia.com/forum.php?mod=guide&view=newthread&mobile=2';
}
}
</script>[/pre]

""
还没有人打赏,支持一下
您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则