Created
October 30, 2014 13:24
-
-
Save simplelife7/808cd4b095c22f365a66 to your computer and use it in GitHub Desktop.
【JS】判断是手Q还是微信还是普通浏览器
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
function getEnv(){ | |
var ua = navigator.userAgent.toLowerCase(); | |
if(/micromessenger(\/[\d\.]+)*/.test(ua)){ | |
return "weixin" | |
}else if(/qq\/(\/[\d\.]+)*/.test(ua) || /qzone\//.test(ua)){ | |
return "qq"; | |
}else{ | |
return "web"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment