HTML Component for window.print() function

I was able to use window print inside the html component but no more now! Please check what happen? i use the onmessage/postmessage function of html component and call window.print function through onload or onclick but both dont work now.

This is very helpful as wix dont have other way around to use friendly print. Please check as this could be a bug. I really need this to work.

HELP,
DA

Cannot confirm. I do the same and it still works. My html-component code:

<script type="text/javascript"> 
	window.onmessage = (event) => {
        if (event.data) {
		document.getElementById("MemberList").innerHTML = event.data;
        }
      };

function sendLoadMessage () {
  window.parent.postMessage("LoadOk", "*");
  }

</script>
<style>
@media print {
  #btnPrint {
    display: none;
  }
}
</style>

</head>
<body onload="sendLoadMessage ();" style="background-color:white;">
    <div id="MemberList"></div>
<div align="center"><button id="btnPrint"  onclick="window.print();">Imprimir</button>`</div>
</body>

Hi Giri

Perhaps because im using the free version of wix. I will try again when website is ready & upgraded.
Thanks,
DA

Did it work as expected?