var ua = navigator.userAgent.toLowerCase(); if(ua.match(/android/i)) == "android") { alert("android"); } if(ua.match(/iPhone/i)) == "iPhone") { alert("iPhone"); } if(ua.match(/iPad/i)) == "iPad") { alert("iPad"); } if(ua.match(/weibo/i) == "weibo"){ alert("weibo"); } if(ua.indexOf('qq/')!= -1){ alert("qq"); } if(ua.match(/MicroMessenger/i)=="micromessenger"){ alert("微信"); }