代码:
const isWeChat = () => {
const userAgent = navigator.userAgent.toLowerCase();
return userAgent.includes('micromessenger');
};
判断当前是微信浏览器或者公司app,就显示按钮,否则不显示:
if (isWeChat() || getCookie('appType')) {
document.getElementsByClassName("share-box")[0].style.display = "block";
}else{
document.getElementsByClassName("share-box")[0].style.display = "none";
}
代码:
const isWeChat = () => {
const userAgent = navigator.userAgent.toLowerCase();
return userAgent.includes('micromessenger');
};
判断当前是微信浏览器或者公司app,就显示按钮,否则不显示:
if (isWeChat() || getCookie('appType')) {
document.getElementsByClassName("share-box")[0].style.display = "block";
}else{
document.getElementsByClassName("share-box")[0].style.display = "none";
}