How to judge the micro-letter built-in browser (implemented through the user agent) _javascript tips

Source: Internet
Author: User

In the micro-credit development of the public account, which is a large number of micro-site development, we need to know that the current browser is a micro-mail built-in browser, then how to judge?

User Agent for micro-trust built-in browsers

How to determine the micro-trust built-in browser, first need to obtain a micro-mail built-in browser user agent, after the IPhone on the micro-mail browser detection, its user agent is:

mozilla/5.0 (IPhone; CPU iPhone os 6_1_3 like Mac os X) applewebkit/536.26 (khtml, like Gecko) mobile/10b329 micromessenger/5.0.1

So by identifying Micromessenger this keyword to determine whether the micro-letter built-in browser.

Judging by JavaScript

function Is_weixin () {
var ua = Navigator.userAgent.toLowerCase ();
if (Ua.match (/micromessenger/i) = = "Micromessenger") {return
} else {return

Judging by PHP

function Is_weixin () { 
if (Strpos ($_server[' http_user_agent '], ' Micromessenger ')!== false) {return
true;< c14/>} return 

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: 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.