WeChat study Note 3 (get WeChat version number), Learning note version number

Source: Internet
Author: User

Learning Note 3 (get the version number), Learning note version number

Because the old version is still in use, the old version of jssdk is different from the new version, you need to determine that the version uses different js APIs

I checked it online. There are two methods to determine a better version:


1. js-based judgment

Var wechatInfo = navigator. userAgent. match (/MicroMessenger \/([\ d \.] +)/I); if (! WechatInfo) {alert ("this activity only supports");} else if (wechatInfo [1] <"5.0 ") {alert ("this activity only supports version 5.0 and later ");}

Original Forum address:

Http://segmentfault.com/q/1010000002536116


2. Use php code to determine

$ Explorer = explode ('micromessenger/', $ _ SERVER ['HTTP _ USER_AGENT']); $ version = str_replace ('. ', '', substr ($ explorer [1], 100); if ($ version <) {$ version = $ version * 10 ;} // determine whether the version is later than or equal to 6.0if ($ version> = 600) {// your code here ...} else {// your code here ...}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.