search

Home  >  Q&A  >  body text

javascript - js如何判断用户是从微信访问的?

js如何判断用户是从微信访问的呢?

ringa_leeringa_lee2902 days ago299

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-10 15:10:27

    function is_weixn(){
    var ua = navigator.userAgent.toLowerCase();
    if(ua.match(/MicroMessenger/i)=="micromessenger") {
    return true;
    } else {
    return false;
    }
    }

    reply
    0
  • 阿神

    阿神2017-04-10 15:10:27

    function is_weixn(){
    var ua = navigator.userAgent.toLowerCase();
    if(ua.match(/microMessenger/i)=="micromessenger") {
    return true;
    } else {
    return false;
    }
    }

    注意大小写

    reply
    0
  • Cancelreply