Created
November 3, 2015 09:32
-
-
Save AJLoveChina/c233c6134c6ae271a4a6 to your computer and use it in GitHub Desktop.
微信-特征识别
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
// 为什么要判断是否是微信打开的网页 ? | |
// 因为微信中打不开淘宝等链接, 如果判断出微信打开了该网页, 我们可以做如下事情 : | |
// 1. 将微信中不能打开的url放在iframe中显示 | |
// 2. 提示用户用浏览器打开该链接 | |
function isWeixinBrowser() { | |
var ua = navigator.userAgent.toLowerCase(); | |
return (/micromessenger/.test(ua)) ? true : false; | |
} | |
/* | |
微信 User Agent | |
安卓 : | |
mozilla/5.0 (linux; u; android 4.1.2; zh-cn; mi-one plus build/jzo54k) applewebkit/534.30 (khtml, like gecko) version/4.0 mobile safari/534.30 micromessenger/5.0.1.352 | |
IOS : | |
mozilla/5.0 (iphone; cpu iphone os 5_1_1 like mac os x) applewebkit/534.46 (khtml, like gecko) mobile/9b206 micromessenger/5.0 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment