if((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
window.location.href="你的手机版地址";
}else{
window.location.href="你的电脑版地址";
}
转载自:http://blog.csdn.net/qq_16494241/article/details/51220571