Last active
April 11, 2016 02:23
-
-
Save luokailuo/7458e8dbfdde4074ef8d3a0b20d75011 to your computer and use it in GitHub Desktop.
Javascript 判断是否微信内置浏览器
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 判断 window.navigator.userAgent 中是否含有关键字:micromessenger */ | |
function isWeiXinBrowser() { | |
var ua = window.navigator.userAgent.toLowerCase(); | |
console.log(ua); | |
if (ua.match(/MicroMessenger/i) == 'micromessenger') { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
if(isWeiXinBrowser()){ | |
console.log("是微信内置浏览器") | |
}else{ | |
console.log("不是微信内置浏览器") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment