js--判断当前环境是否为微信环境

     /**
     * 判断是否是微信环境
     */
    function getIsWxClient () {
        var ua = navigator.userAgent.toLowerCase();
        if (ua.match(/MicroMessenger/i) == "micromessenger") {
            return true;
        }
        return false;
    };
原文地址:https://www.cnblogs.com/wangyuyuan/p/9909290.html