draco1023
5/5/2017 - 10:00 AM

detect wechat

detect wechat

var isWeixin = false;

if (document.addEventListener) {
    document.addEventListener("WeixinJSBridgeReady", function() { isWeixin = true; }, false);
}

window.onload = function() {
	if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
	    isWeixin = true;
	}	
}