Hi,
I am trying to send a message from my html element to the wix page that the html element is on. I have come across:
function respond() { window.parent.postMessage(“Message for page code”, “*”); }
Being used in the html element, used in conjunction with:
$w.onReady(function () { // when a message is received from the HTML element $w(“#myHtmlElement”).onMessage( (event) => {
$w(“#text1”).text = event.data; } ); } );
Which is being used at the top of the code for the wix page. I can’t seem to get a message that I want passed from the html element to the wix page. Any suggestions? When reading the data that is sent from the html element to a text box on my wix page I get the following text string:
{
“postRobot”: {
“type”: “postrobot_message_request”,
“hash”: “postrobot_ready_888776c67c”,
“name”: “postrobot_ready”,
“data”: {},
“domain”: “*”,
“sourceDomain”: “https://5e0e5577-08e4-4805-8960-be51159ca8c7.htmlcomponentservice.com”,
“id”: “7a426dfa8c”,
“windowType”: “iframe”
}
}
Any ideas?
Grant