规范说,我应该能够在窗口对象上使用 postMessage() 。Mozilla 说,我应该也可以在 open() 的窗口上执行此操作。
但是,我采用了 Robert Nyman 的 postMessage 示例并尝试让它跨 windows工作。但是,IE10 和 Chrome 似乎都没有为新打开的窗口提供 postMessage 功能。
var target = … // original declaration
popoutbutton.onclick = function(evt) {
realWin = window.open(iframeWin.frameElement.src, "window1", "width=600,height=400,status=yes,scrollbars=no,resizable=yes");
target = realWin;
target.focus();
};
// …snip…
target.postMessage(myMessage.value, expectorigin); // <-- fails because target.postMessage() is undefined
我错过了什么还是这个功能根本不存在?
- 下面更新 -
开发人员预览似乎根本没有这样做。我再次尝试使用消费者预览版。IE10 (build 8250) 和预期的一样。谢谢你的帮助!