Micro-letters are now almost universally used, but the micro-mail version has been updated, different versions have different functions, so it is important to understand the micro-letter version number, so that they can update the experience of new features in a timely manner. So how to use JS to obtain the micro-letter version number?
First, to judge the micro-letter version number
var wechatinfo = Navigator.userAgent.match (/micromessenger\\/([\\d\\.] +)/i);
if (!wechatinfo) {
alert ("This activity only supports micro-letters");
} else if (Wechatinfo[1] < "5.0") {
alert ("This activity only supports micro-letter 5.0 versions");
}
Where the value of wechatinfo[1] is the version number
Second, JS to determine whether in the micro-letter browser Open
function Is_weixn () {
var ua = Navigator.userAgent.toLowerCase ();
if (Ua.match (/micromessenger/i) = = "Micromessenger") {return
true;
} else {return
false
;
}}
The above mentioned is the entire content of this article, I hope you can enjoy.