var ua = navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i)=="micromessenger") { //return "weixin"; alert("微信") } else if (ua.match(/QQ/i) == "qq") { //return "QQ"; alert("QQ") }else { return false; alert("不是微信浏览器或手机qq浏览器"); }