1. First:
Copy codeThe Code is as follows: function IsPC (){
Var userAgentInfo = navigator. userAgent;
Var Agents = ["Android", "iPhone ",
"SymbianOS", "Windows Phone ",
"IPad", "iPod"];
Var flag = true;
For (var v = 0; v <Agents. length; v ++ ){
If (userAgentInfo. indexOf (Agents [v])> 0 ){
Flag = false;
Break;
}
}
Return flag;
}
2. Type 2:
Copy codeThe Code is as follows: function browserRedirect (){
Var sUserAgent = navigator. userAgent. toLowerCase ();
Var bIsIpad = sUserAgent. match (/ipad/I) = "ipad ";
Var bIsIphoneOs = sUserAgent. match (/iphone OS/I) = "iphone OS ";
Var bIsMidp = sUserAgent. match (/midp/I) = "midp ";
Var bIsUc7 = sUserAgent. match (/rv: 1.2.3.4/I) = "rv: 1.2.3.4 ";
Var bIsUc = sUserAgent. match (/ucweb/I) = "ucweb ";
Var bIsAndroid = sUserAgent. match (/android/I) = "android ";
Var bIsCE = sUserAgent. match (/windows ce/I) = "windows ce ";
Var bIsWM = sUserAgent. match (/windows mobile/I) = "windows mobile ";
If (! (BIsIpad | bIsIphoneOs | bIsMidp | bIsUc7 | bIsUc | bIsAndroid | bIsCE | bIsWM )){
Window. location. href = B page;
}
}
BrowserRedirect ();