我已经构建了一个 Excel 加载项,它通过以下方式打开一个弹出窗口window.open
,然后加载项与弹出站点进行通信。我刚刚意识到它在 Windows 的 Excel 中不起作用,原因是弹出窗口无法通过以下方式获取主机$window.opener
.
为了说明这一点并避免跨域,我做了a xml https://www.matrixlead.com/testWindowOpener/manifest-windowopener.xml,它指的是插件 https://www.matrixlead.com/testWindowOpener/Home.html and 测试页 https://www.matrixlead.com/testWindowOpener/Window.html。它在 Chrome 和 IE 中的 Excel Online 中运行良好。但是,在 Windows 版 Excel 中运行它时,$window.opener
回报undefined
.
谁能告诉我发生了什么事以及解决方法是什么?
(推荐Dialog API的人请参阅这个线程 https://stackoverflow.com/questions/44541675/storageevent-or-efficient-way-to-check-regularly-a-value-in-storage。所以现在 Dialog 和window.open
适用于 Windows 版 Excel)。
UI.messageParent
也行不通?它来自于官方文档 https://dev.office.com/reference/add-ins/shared/officeui.messageparent.
Example:
Office.context.ui.messageParent("Message from Dialog box")
Docs:
将消息从对话框传递到其父/开启页面。调用此 API 的页面必须与父页面位于同一域中。
(我认为这不是您提到的 Dialog API)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)