message-channel

window.opener does not work in Excel for Windows

旧巷老猫 提交于 2019-12-12 16:41:01
问题 I have built an Excel add-in, it opens a popup by window.open , then the add-in communicates with the popup site. I just realised that it does NOT work in Excel for Windows, the reason is that the popup can NOT get the host by $window.opener . To illustrate this and avoid cross-domain, I have made a xml, which refers to the add-in and the test page. It works well in Excel Online in Chrome and in IE. However, while running it in Excel for Windows, $window.opener returns undefined . Could

Using MessageChannel() bidirectionally for multiple messages between page and iframe

我怕爱的太早我们不能终老 提交于 2019-12-06 15:20:47
问题 I'm using MessageChannel() to pass messages between a page and iframe. In my scenario, the iframe is the communications initiator and the page containing it receives, transforms and responds back to the iframe. As I was implementing the system I at first took and saved a reference to the port passed to the iframe, cached it and continue to use it for each subsequent communication. iframe: window.onmessage = (e) => { console.log("iframe port established"); //using this port for all following