I followed this tutorial: https://developers.google.com/apps-script/guides/dialogs#file-open_dialogs and I can open a Google Picker after clicking a button inside my addon s
Sidebar and modal dialog are not able to communicate despite having same origin.
It is possible to get a reference to the sidebar html from modal dialog through window.top. From there, it is possible to
window.postMessage() to communicate with each otherWithout a reference to each other, it is still possible to communicate with each other through
addOn.html
Addon
Loading modal dialog...
modalAddOn.html
Modal Dialog
code.gs
function testModal() {
SpreadsheetApp.getUi().showModelessDialog(
HtmlService.createHtmlOutputFromFile('modalAddOn')
.setHeight(500)
.setWidth(300),
' '
);
}
function onOpen(e) {
SpreadsheetApp.getUi()
.createMenu('Sidebar')
.addItem('Show Add-On', 'showSidebar')
.addToUi();
}
function showSidebar() {
SpreadsheetApp.getUi().showSidebar(
HtmlService.createTemplateFromFile('addOn.html').evaluate()
);
}
Where is my iframe in the published web application/sidebar?
Window#postMessage
Window#storage
Origin