I set my website as a premium plan. I tried to send a message from HTML to the page, but without success. Hope to get help.
The following is program running.
Code source from
The elements are #text1, #messageSendButton, #textInput1, #myHtmlComponent
The following are the photo of elements and code,
The following is the code in #myHtmlComponent
< html >
< head >
< style >.button {
background-color: #155DE9;
color: white;
border: none;
padding: 10px20px;
text-align: center;
font-family: ‘Arial’;
}
.label {
font-family: ‘Arial’;
}
.input { font-size: 14px;
}
</ style >
< script type=“text/javascript”>
// when a message is received from the page code
window.onmessage = (event) => {
if (event.data) { document.getElementById(“theLabel”).innerHTML = event.data;
}
};
// send message to the page code
function button_click () { window.parent.postMessage(document.getElementById(“theMessage”).value, “http://mysite.com”);
}
</ script >
</ head >
< body >
< span id="theLabel"class=“label”>HTML Label</ span >
< br />< br />
< button class=“button” onclick =“button_click()”>< SendMessage
< br />< br />
< input type="text"class =“input” id=“theMessage”>
</ body >
</ html >