postMessage( )


Sends a message to the page's parent.

If a page is embedded within another site, using an HtmlComponent on a Wix site or an iframe on a non-Wix site, you can use the postMessage() function to send a message from the inner site to the outer site.

When the parent site is a Wix site, use the onMessage() function to receive the message on the parent page.

When the parent site is a non-Wix site, use the page's window.onMessage event handler to read the data property of the received MessageEvent to receive the message on the parent page.

Method Declaration
Copy
Method Parameters
messageobjectRequired

The message to send.


targetstring

The target to send the message to. Must be "parent" or omitted. Defaults to "parent".

Returns
Return Type:Promise<object>
Was this helpful?
Yes
No