Mobile redirect - issue catching IE users
Any ideas why this is redirecting IE users?
function Client() {
}
Client.prototype.mobileClients = [
"palm",
"blackberry" ,
"nokia",
"phone",
"midp",
"mobi",
"symbian",
"chtml",
"ericsson",
"minimo",
"audiovox",
"motorola",
"samsung",
"telit",
"upg1",
"ce",
"ucweb",
"astel",
"plucker",
"x320",
"x240",
"j2me",
"sgh",
"portable",
"sprint",
"docomo",
"kddi",
"softbank",
"android",
"mmp",
"pdxgw",
"netfront",
"xiino",
"vodafone",
"portalmmm",
"sagem",
"mot-",
"sie-",
"ipod",
"up\\.b",
"webos",
"amoi",
"novarra",
"cdm",
"alcatel",
"pocket",
"ipad",
"iphone",
"mobileexplorer",
"mobile"
];
Client.prototype.isMobileClient = function(userAgent)
开发者_如何转开发{
userAgent = userAgent.toLowerCase();
for (var i in this.mobileClients) {
if (userAgent.indexOf(this.mobileClients[i]) != -1) {
window.location.replace("../../US-EN/Moment/Mobile/");
return true;
}
}
return false;
}
var client = new Client();
client.isMobileClient(navigator.userAgent);
Well for one ce
matches Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media **Ce**nter PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7)
Which is the IE media center edition.
Another idea would be to give us the useragent that it is effecting.
精彩评论