用JS判断访问跳转手机端和PC端代码,仅供参考。
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://3g.xxxx.com";
}
}