First understand the UA (User agent: user agent) of Android WeChat and Ios WeChat
Android WeChat UA:
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 WeChat UA:
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
2. Open Chrome, F12 to open the developer tools, click the menu button -----More Tools -----Network condition to open the Network condition window
3. In the User agent option, select Custom, and then enter the UA of Android or Ios in the text box below.
4. Test the results
1 <script type="text/javascript"> 2 window.onload = function() { 3 isWeixinBrowser(); 4 } 5 //Determine whether WeChat is a browser 6 function isWeixinBrowser() { 7 var ua = navigator.userAgent.toLowerCase(); 8 var result = (/micromessenger/.test(ua))? true: false; 9 if (result) { 10 console.log('You are accessing WeChat browser'); 11 } 12 else { 13 console.log('You are not visiting WeChat browser'); 14 } 15 return result; 16 } 17 </script>
It's successful, you try it too
Alipay browser is to add AlipayClient to the custom ua and refresh the page, it will be automatically brought