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 anyone tell me what happened, and what's the workaround?

(for people who recommend Dialog API, please see this thread. So now neither Dialog nor window.open works in Excel for Windows).


回答1:


UI.messageParent also won't work? It's from the official docs.

Example:

Office.context.ui.messageParent("Message from Dialog box")

Docs:

Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent.

(I assume this isn't the Dialog API which you referring)



来源:https://stackoverflow.com/questions/44655202/window-opener-does-not-work-in-excel-for-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!