var u = navigator.userAgent;
var ua = navigator.userAgent.toLowerCase();
if (u.indexOf("Android") > -1 || u.indexOf("Linux") > -1) {
alert('Android')}if (u.indexOf("iPhone") > -1 || u.indexOf("iOS") > -1) {
alert('ios'} // The current page is opened in wechatif(ua.match(/MicroMessenger/i) == "micromessenger"){
alert('Current page is open in wechat')}Copy the code