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>
<scripttype="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
functionbutton_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</button>
<br/><br/>
<input type="text"class ="input" id="theMessage">
</body>
</html>
You are sending it to ""http://mysite.com". The idea is that you change that URL to a real one. For testing in Preview, please ignore the warning about "*" in the article. Use it, when it works, replace the * with a good httpS-URL and Publish.