this.exportUnits = d;
var g = "status=no,resizable=no,scrollbars=yes,personalbar=no,directories=no,location=no,toolbar=no,menubar=no,width=760,height=530,left=60,top=80";
this.popupWindow = b.open(a.settings.multiPopupUrl, "", g);
if (this.exportUnits && this.exportUnits.length) {
var bs = JSON.stringify(this.exportUnits);
this.popupWindow.postMessage(bs, a.settings.multiPopupUrl)
}
上述代码是打开一个新窗口同时postMessage一段消息到弹出的新窗口,但是弹出的新窗口有时收到有时收不到,收到的几率很少,求大神帮助
下面是新窗口接收的代码
function loadImg() {
window.addEventListener("message", receiveMessage, false);
}
function receiveMessage(event) {
alert(event.origin);
alert(event.data);
alert(event.source);
}