判断是UC还是QQ浏览器还是微信

var Browser = '';
    var ua = navigator.userAgent.toLowerCase();//获取判断用的对象
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
        //weixin
        alert('weixin');
        Browser = 'WX';
    }
    else if(navigator.userAgent.indexOf('UCBrowser') > -1){
        alert('UC');
        //UC
        Browser = 'UC';
    }
    else if(navigator.userAgent.indexOf('MQQBrowser') > -1){
        alert('QQ');
        //MQQBrowser
        Browser = 'QQ';
    }

转载:https://blog.csdn.net/weixin_45791806/article/details/122318043

两个判断,微信或QQ或UC还是其他浏览器

var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger" || navigator.userAgent.indexOf('UCBrowser') > -1 || navigator.userAgent.indexOf('MQQBrowser') > -1) {

    alert('微信或QQ或UC');
}
else{
    alert('其他浏览器');
   
}