HTML Component - messaging isn't working (even the code in the example isn't working)

Hi, I’ve used the example in this help page to make a simple message exchange between the page and the component, but I can’t make it work.

My task is loading other products as “variants” into a product page (these variants are related to few main products and there’s a need for single inventory management for all the variants), I want to pass to the HTML component the products array it needs to render, and send back to the page the selected product.

What I’ve managed to do is hook the postMessage method to an onClick event, the HTML component did modify innerHTML as written in the help page but it didn’t send a message back to parent.

Thoughts?

Thanks

In addition, I’m seeing this in Chrome DevTools console:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://585a1388-1fb0-4d47-a79d-807050688165.htmlcomponentservice.com') does not match the recipient window's origin ('https://editor.wix.com').

The article Wix Code: Working with the HTML Element explains in detail how to send messages back and forth between the Page and the code in the HtmlComponent. See the section Sending a Message from an HTML Element to Page Code .

thanks, will try that page.