判断当前的浏览器是pc还是移动设备,如果是手机,就跳转到对应手机端网站
var sUserAgent=navigator.userAgent;
var mobileAgents=['Android','iphone','Symbian','windowsPhone','iPod','BlackBerry','Windows CE'];
var goUrl = 0;
for( var i=0;i<mobileAgents.length;i++){
if(sUserAgent.indexOf(mobileAgents[i]) > -1){
goUrl = 1;
break;
}
}
if (goUrl == 1){
location ='http://www.bAIdu.com';
}