$w('#html1').postMessage("<html>Hi!</html>"); shows nothing

Hi,

postMessage(…) does not set the content of HTML component. It marelly posts the message to the component, that can be then received and acted upon.

You can do that with a bit of code inside of HTML. The code would receive the message and make it appear in the component. You can put this snippet into HTML component:

<script>
window.onmessage = (event) => {
  document.getElementById("container").innerHTML = event.data;
}
</script>
<div id="container">
</div>

What it does, is listens to the message being posted and sets the content to the div container.

I hope this helps. Let me know!

You can also checkout the documentation here

And a community tutorial of a more complex case: