function isWeixinBrowser() {
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("micromessenger") != -1) {
return true;
} else {
return false;
}
}
// 使用示例
if (isWeixinBrowser()) {
console.log("当前为微信浏览器");
} else {
console.log("当前不是微信浏览器");
}
JS 判断当前浏览器是否为微信浏览器
于 2023-04-10 16:20:39 首次发布