判断是否是微信/QQ内置浏览器

const broswer = () => {
    const ua = navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
        return "weixin";
    } else if (ua.match(/QQ/i) == "qq") {
        return "QQ";
    }
    return false;
}
console.log(broswer())

 

posted @ 2022-05-26 22:44  前端搬运工bug  阅读(89)  评论(0编辑  收藏  举报