网页判断是手机访问还是电脑访问网站、判断是微信、判断是android或iphone

    <script type="text/javascript">
    var system ={};  
    var p = navigator.platform;       
    system.win = p.indexOf("Win") == 0;  
    system.mac = p.indexOf("Mac") == 0;  
    system.x11 = (p == "X11") || (p.indexOf("Linux") == 0); 
    if(system.win||system.mac||system.xll){//如果是电脑        
//window.location.href="";
}else{ //如果是手机
window.location.href="Mobile.aspx";
} </script>

 

function checkClient() {
        var _userAgent = navigator.userAgent;
        var isAndroid = _userAgent.indexOf('Android') > -1 || _userAgent.indexOf('Adr') > -1;
        var isiOS = !!_userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        if (isAndroid) {
            
        }
        else if(isiOS) {
            
        }
        else
        {
        
        }
    } 

    function isWeiXin(){
        var ua = window.navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i) == 'micromessenger'){
            return true;
        }else{
            return false;
        }
    }   

 

posted @ 2016-01-14 09:05  事理  阅读(2284)  评论(0编辑  收藏  举报