window.addEventListener("load", function () { if (window.navigator.userAgent.indexOf("WeChat") > -1) { //... } });