Resize embedded iframe using parent.postMessage

I have an app that includes a table. When the table is loaded or a row is clicked, I want to send the window dimensions to the parent.

I have "Enable parent window communication" enabled and I am using the following script:

console.log("Message saying where the post is coming from")

const message = {
  height: viewport.height,
  width: viewport.width
}

parent.postMessage(message)

I have placed this in:

  • Row actions on the table using "Run script"
  • Interactions event handlers on the table using "Select row"
  • Interactions event handlers on the table using "Focus"

I never see the posted message on the parent, and I don't see the log message in Retool.

Hi @HashNotAdam,

Thanks for reaching out!

Do you see the Message saying where the post is coming from log in the browser console when triggering the event in the non-embedded version?

Does it work if you update the last line in the script to: parent.postMessage(message,'*')