业务来回切换二维码,需要重复调用window.Wwlogin方法,该方法源码在window添加了message监听,解决方法修改源码并暴露取消监听方法
!function (a, b, c) {
function hhe(b) {
b.data && b.origin.indexOf("work.weixin.qq.com") > -1 && (a.location.href = b.data)
}
function d (c) {
var d = b.createElement("iframe"),
e = "https://open.work.weixin.qq.com/wwopen/sso/qrConnect?appid=" + c.appid + "&agentid=" + c.agentid + "&redirect_uri=" + c.redirect_uri + "&state=" + c.state + "&login_type=jssdk";
e += c.style ? "&style=" + c.style : "", e += c.href ? "&href=" + c.href : "", d.src = e, d.frameBorder = "0", d.allowTransparency = "true", d.scrolling = "no", d.width = "300px", d.height = "400px";
var f = b.getElementById(c.id);
f.innerHTML = "", f.appendChild(d), d.onload = function () {
d.contentWindow.postMessage && a.addEventListener && (a.addEventListener("message", hhe), d.contentWindow.postMessage("ask_usePostMessage", "*"))
}
} a.WwLogin = d
a.removeWwLogin=function(){
a.removeEventListener('message',hhe);
}
}(window, document);
你好,现在是有提供新版的js文件 http://wwcdn.weixin.qq.com/node/wework/wwopen/js/wwLogin-1.2.4.js 可以看下是否有解决这个问题
您好,请问您这个问题后来怎么解决的啊?麻烦了,感谢感谢!