window.navigator.userAgent.toLowerCase();获取微信的串
window.onload = function(){
if(isWeiXin()){
var Big=document.getElementById("Big_box")
Big.style.display='block'
}else{
var Big=document.getElementById("Big_box")
Big.style.display='none'
}
}
function isWeiXin(){
var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
return true
}else{
return false
}
}
傻瓜教程, window.onload下的判断里写你的逻辑就可以了
通过检查`window.navigator.userAgent.toLowerCase()`来判断页面是否在微信内置浏览器中打开,可在`window.onload`事件下实现相关逻辑。
1589

被折叠的 条评论
为什么被折叠?



