这个代码放在PC模板的代码里面:

<script type="text/javascript"> 
//平台、设备和操作系统 
var system ={ 
win : false, 
mac : false, 
xll : false
}; 
//检测平台 
var p = navigator.platform; 
system.win = p.indexOf("Win") == 0; 
system.mac = p.indexOf("Mac") == 0; 
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
if(system.win||system.mac||system.xll){   
}else{
window.location.href="手机网址";
}
</script>

此代码放在手机网站模板里面:

<script type="text/javascript"> 
//平台、设备和操作系统 
var system ={ 
win : false, 
mac : false, 
xll : false
};
//检测平台
var p = navigator.platform; 
system.win = p.indexOf("Win") == 0; 
system.mac = p.indexOf("Mac") == 0; 
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
if(system.win||system.mac||system.xll){   
window.location.href="PC网址";
}else{ 
}
</script>

js判断移动端和电脑端跳转代码:

var browser_class = navigator.userAgent;
var browser_class_name1 = browser_class.match("Mobile");
var browser_class_name2 = browser_class.match("mobile");
var location_url = window.location.href;
if (browser_class_name1 != null || browser_class_name2 != null){
if (location_url.match("wap") == null){
window.location.href="http://wap.xxxx.com";
}
}else{
if (location_url.match("3g") != null || location_url.match("wap") != null){
window.location.href="http://wap.xxxx.com";
}
}