Created
May 17, 2017 06:57
-
-
Save dolphin836/6a2e678b831b51b89e3bb9ff7540c6e0 to your computer and use it in GitHub Desktop.
[通过 User Agent 识别微信和支付宝内置浏览器] #tags:微信,支付宝,浏览器
This file contains hidden or 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 is_weixin() | |
{ | |
var ua = navigator.userAgent.toLowerCase(); | |
if(ua.match(/MicroMessenger/i) == "micromessenger") | |
{ | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} | |
function is_zhi() | |
{ | |
var ua = navigator.userAgent.toLowerCase(); | |
if(ua.match(/MicroMessenger/i) == "AlipayClient") | |
{ | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} |
This file contains hidden or 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 is_weixin() | |
{ | |
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) { | |
return true; | |
} | |
return false; | |
} | |
function is_zhi() | |
{ | |
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'AlipayClient') !== false ) { | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment