postMessage( )


Sends a message to a 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, call this method to send a message from the inner site to the outer site.

When the parent site is a Wix site, call onMessage() 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
messageMessageRequired

The message to send.


targetstring

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

Returns
Return Type:Promise<object>
Did this help?