Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/www.xcondor.cn/usr/plugins/AMP/Action.php on line 381

Warning: getimagesize(): Filename cannot be empty in /www/wwwroot/www.xcondor.cn/usr/plugins/AMP/Action.php on line 469
JS 判断设备来源

沙漠里的小蜜蜂

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();
    window.addEventListener('resize', function(){
        deviceType();
    })


    微信的 有些不太一样
    function isWeixin(){
        var ua = navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i)=='micromessenger'){
            return true;
        }else{
            return false;
        }
    }

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »

因本文不是用Markdown格式的编辑器书写的,转换的页面可能不符合AMP标准。