判断你的浏览设备: navigator.userAgent.toLowerCase(); (返回当前用户所使用的是什么浏览器,将获得的信息变成小写)
function browserRedirect() {
var _devices= navigator.userAgent.toLowerCase();
var bIsIpad = _devices.match(/ipad/i) == "ipad";
var bIsIphoneOs = _devices.match(/iphone os/i) == "iphone os";
var bIsMidp = _devices.match(/midp/i) == "midp";
var bIsUc7 = _devices.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = _devices.match(/ucweb/i) == "ucweb";
var bIsAndroid = _devices.match(/android/i) == "android";
var bIsCE = _devices.match(/windows ce/i) == "windows ce";
var bIsWM = _devices.match(/windows mobile/i) == "windows mobile";
document.writeln("您的浏览设备为:");
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
// document.writeln("phone");
// 移动设备显示状态
} else {
// pc设备显示状态
}
}