js 判断客户端类型

11 min read
  var g_sUA = navigator.userAgent.toLowerCase();
                        var android = g_sUA.match(/(android)\s+([\d.]+)/);
                        var ios = g_sUA.match(/(ipad|iphone|ipod).*os\s([\d_]+)/);
                        if(android || ios){
                            location.href = '//m.qzone.com/l?sid='+getHttpParams('sid')+'&g_f='+getHttpParams('g_f')+'&groupid=17&g=145';
                        } else {
                            location.href = '//rc.qzone.qq.com/myhome?action=auto_popup_checkin&checkin_groupid=17&checkin_source=song';
                        }