JS判断是否来自手机移动端的访问,并跳转

时间:2022-04-29 16:10:08
var browserName_ = navigator.userAgent ;
if(browserName_.indexOf("iPad")<&&browserName_.indexOf("Windows NT")<&&browserName_.indexOf("Macintosh")<){
if(browserName_.indexOf("Linux")>){
if(browserName_.indexOf("Mobile")>||browserName_.indexOf("U;")>){
location.href="http://xxx.xxx.com/";
}
}
else{
location.href="http://xxx.xxx.com/";
}
}