Send a message from host page to Dialog box

那年仲夏 提交于 2019-12-13 07:27:49

问题


I am trying to use Dialog API of Office Add-ins.

According to the doc, we could use Office.context.ui.messageParent to send a message from the Dialog box to the host page (eg, task pane). Whereas, I don't see how we could send a message from the host page to the Dialog box.

Does anyone know how to do this?


回答1:


There are 2 possible solutions:

  1. Send data as query params, when you open a pagein dialog box.
  2. If there are in same domain then localstorage should be available in dialog which was opened. setInterval(function () { var value = localStorage.getItem("dataFromDialog"); }, 500) You can write the same value in localStorage in dialog localStorageSetItem("dataFromDialog", "message to parent")


来源:https://stackoverflow.com/questions/44183480/send-a-message-from-host-page-to-dialog-box

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