function IsMobile () {
var suseragent= navigator.userAgent.toLowerCase (),
bisipad= Suseragent.match (/ipad/i) = = "ipad",
bisiphoneos= Suseragent.match (/iphone os/i) = = "iphone OS",
bismidp= Suseragent.match (/midp/i) = = "MIDP",
bisuc7= Suseragent.match (/rv:1.2.3.4/i) = = "rv:1.2.3.4",
bisuc= Suseragent.match (/ucweb/i) = = "UCWeb",
Bisandroid= Suseragent.match (/android/i) = = "Android",
Bisce= Suseragent.match (/windows ce/i) = = "Windows CE",
biswm= Suseragent.match (/windows mobile/i) = = "Windows Mobile",
Biswebview = Suseragent.match (/webview/i) = = "WebView";
Return (Bisipad | | bisiphoneos | | bismidp | | bIsUc7 | | bisuc | | bisandroid | | bisce | | biswm);
}
function IsMobile02 () {
platforms, devices, and operating systems
var system = {
Win:false,
Mac:false,
Xll:false
};
Testing platform
var p = navigator.platform;
System.win = P.indexof ("win") = = 0;
System.mac = P.indexof ("mac") = = 0;
system.x11 = (P = = "X11") | | (P.indexof ("Linux") = = 0);
Jump statement
if (System.win | | system.mac | | system.xll) {//Turn to Background landing page
Window.location.href = "index.html";
return false;
} else {
return ture;
Window.location.href = "homeindex.aspx";//Mobile phone
}
}
JS how to determine whether it is mobile or PC-side access