能判断是电脑端还是手机端的javascript,自动跳转到手机wap版网站: http://yijile.com/log/239.html
方法一:
try {
var urlhash = window.location.hash;
if (!urlhash.match("fromapp"))
{
if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{
window.location="http://bjgpnd.com/yidongduan/";
}
}
}
catch(err)
{
}
方法二:
可在pc端代码处加入:if(screen.width<='1024')
window.location = "手机端url";
else{}手机端代码处加入:if(screen.width<='640')
window.location = "pc端url";
else{}
网友评论