移动重定向 - 发布捕获IE用户的问题

时间:2011-01-14 21:32:42

标签: mobile user-agent

为什么这会重定向IE用户?

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);

1 个答案:

答案 0 :(得分:1)

一个ce个匹配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)哪个是IE媒体中心版。

另一个想法是向我们提供它正在影响的使用者。