通过JS判断设备类型

function deviceType(){
    var ua = navigator.userAgent;
    var agent = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];    
    for(var i=0; i<len,len = agent.length; i++){
        if(ua.indexOf(agent[i])>0){         
            break;
        }
    }
}
deviceType();

 

posted @ 2017-03-02 16:29  wjw_Dream  阅读(658)  评论(0编辑  收藏  举报