代码如下;
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';
}
网友评论