杰奇手机打开电脑网站自动跳转到手机端网站
下面是JS代码,可以把它新建一个.JS文件,然后在网页中调用这个Js文件
UA = navigator.userAgent.toLowerCase();
url = window.location;
url = url.toString();
if((UA.indexOf('iphone') != -1 || UA.indexOf('mobile') != -1 || UA.indexOf('android') != -1 || UA.indexOf('ipad') != -1 || UA.indexOf('windows ce') != -1 || UA.indexOf('ipod') != -1) && UA.indexOf('ipod') == -1) {
url=url.replace("www.","m.");
Go(url);
}
function Go(url) { window.location = url;}
发表评论