// 方法1:
if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
//alert("移动")
} else {
//alert("pc")
}
// 方法2 需要核实这些 东西是什么?
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;
}
var IsPC = IsPC();
if(IsPC){
$("#isShowOnPC2").show();
}else{
$("#isShowOnPC2").hide();
}
// 判定是什么访问的
function checkClinetModelIsPC() {
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1;
var isIos = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
if (isAndroid || isIos) {
return false;
}
return true;
};
checkClinetModelIsPC();
var pcMethods_3 = checkClinetModelIsPC();
if(pcMethods_3){
$("#pcMethods_3").show();
}else{
$("#pcMethods_3").hide();
}
// 方法3
// 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页面;
// }
// }
// browserRedirect();