try { var ua = navigator.userAgent.toLowerCase(); var isWeixin = ua.indexOf('micromessenger') != -1 && ua.indexOf('wxwork') == -1; if (isWeixin && self == top && (!tmpGetCookie("_checkWxLogin") || !tmpGetCookie('_wxOpenId2'))) { document.cookie = "_checkWxLogin=true"; document.location.href = '/wxGetOpenId.jsp?returnUrl=' + encodeURIComponent(document.location.href); } } catch (e) {} function tmpGetCookie(name) { var arr = document.cookie.replace(/\s/g, "").split(';'); for (var i = 0; i < arr.length; i++) { var tempArr = arr[i].split('='); if (tempArr[0] == name) { return decodeURIComponent(tempArr[1]); } } return ''; }