var isPC = function (){ var userAgentInfo = navigator.userAgent.toLowerCase(); var Agents = new Array("android", "iphone", "symbianOS", "windows phone", "ipad", "ipod"); var flag = true; for (var v = 0; v < Agents.length; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } } return flag; } var pcUlr = "https://www.du4x4.com"; var mobleUlr = "https://www.du4x4.com/m_m/"; if(isPC()&&window.location.href.indexOf(mobleUlr)!=-1){ window.location.href = pcUlr+GetUrlRelativePath() }else if(!isPC()&&window.location.href.indexOf(pcUlr)!=-1){ window.location.href = mobleUlr+GetUrlRelativePath() } function GetUrlRelativePath(){ var url = document.location.toString(); var arrUrl = url.split("//"); var start = arrUrl[1].indexOf("/"); var relUrl = arrUrl[1].substring(start);//stop省略,截取从start开始到结尾的所有字符 if(relUrl.indexOf("?") != -1){ relUrl = relUrl.split("?")[0]; } return relUrl; }

亚洲必赢注册网址