我postMessage在 Firefox 和 Internet Explorer 中使用时遇到了问题,而 Google Chrome 每次都运行良好。
我想要做的是postMessage从 iFrame 到我的父母使用closeForm. iFrame URL 是父域的子域,iFrame 源本身也有document.domain = document.domain我认为应该对我的问题进行排序的。
目前 iFrame JavaScript 正在调用window.top.postMessage('closeForm', '*'),正如我所提到的,它在 Chrome 中是一种享受,但在 Firefox 中我得到了ReferenceError: window is undefined,所以我改为window.top但parent.postMessage我得到相同的东西只有parent is not defined.
同样的事情在 IE9 中也不起作用。有什么建议么?