Hi all
I want to create a program that calls the function on the Wix side when someone click on the HTML link.
The following is the program I created.
(1)HTML side
<!doctype html>
<html>
<head>
</head>
<script type="text/javascript">
function showAlert(){
function sendLoadMessage () {
console.log("In sendLoadMessage of html");
window.parent.postMessage("LoadOk", "*");
console.log("loadok sent");
}
}
</script>
<body onload="sendLoadMessage ();">
<script src="//****.com/8**k" onclick="showAlert();"> // ****.com/8**k is outside link
</script>
</body>
</html>
(2)Wix side code
$w.onReady(function () {
//TODO: write your page related code here...
$w("#html1").onMessage( (event) => {
console.log("message recieve 2");
});
});
export function html1_message_1(event, $w) {
//Add your code for this event here:
console.log("message test");
}
I want to receive the event that HTML was clicked, but I can not make it well.
Could you tell me what to do?
Thanks for your reply.
I will try it.
https://www.wix.com/corvid/reference/$w.HtmlComponent.html
https://support.wix.com/en/article/corvid-working-with-the-html-element