HTML iFrame postMessage

Hello!

I have HTML iFrame with code like that:

<script src="https://othersite.com/js/script.js"></script>
<a class="button" href="https://othersite.com/product" target="_blank" data-single-product="true">ButtonName</a>

And I want to make the href link variable by sending a message from page code with help of postMessage.

For example, I have a dataset with a list of various links and I want to substitute them in that HTML iFrame code in href value.

Is this real? Do I correctly understand the purpose of this function?
How to do this?

You would need to make use of Wix HTML Component and pass data from the page to it or vice versa with the use of onMessage and postMessage.
https://support.wix.com/en/article/corvid-working-with-the-html-element
https://www.wix.com/corvid/reference/$w.HtmlComponent.html

Also, if you want to ad variable urls from a dataset, then you would need to be using src as well.
https://www.wix.com/corvid/reference/$w.HtmlComponent.html#src

If you use the search function on this forum, this has been asked about in previous posts.
https://www.wix.com/corvid/forum/community-discussion/how-to-make-an-html-element-src-dynamic
https://www.wix.com/corvid/forum/community-discussion/load-iframe-from-database-to-html-component

Your post seems very similar to one recently here.
https://www.wix.com/corvid/forum/community-discussion/html-button-connected-to-database