Iframe content in the html code block sometimes does not load

Hi Community.

We have an issue with the html code block, where we are trying to embed external content with an iframe. Our content doesn’t always load when the Softr page loads. Our content site’s developers suggested that it’s because the Softr page (parent) loads faster than the embedded content (child). There is some dynamic iframe height resizing going on in the code block with javascript, based on the size of the content.

  window.onmessage = (e) => {
    if (e.data.hasOwnProperty("frameHeight")) {
      document.getElementById("iframe").style.height = `${
        e.data.frameHeight + 80
      }px`;
      document.getElementById("iframe-height").innerHTML = `${
        e.data.frameHeight + 80
      }px`
    }

When the content doesn’t load (black screens for the video tiles), the insect console reveals the following error:
my-vouches:552 Uncaught TypeError: Cannot set properties of null (setting ‘innerHTML’)
at window.onmessage (my-vouches:552:62)

So, I am pretty sure it has something to do with window. onmessage.

I realize this is a complex topic, but I was wondering if Softr community have dealt with any similar issues and if there may be a potential quick solution to this.

Thanks
Boris

Can you please share a link to check ?

We have found a work-around for this solution by eliminating “indexing” of the content at the source. Loading content in an iframe in Softr caused re-indexing to occur and the parent page was getting confused. This is a very “fringe” use case, so I don’t want to take too much of anyone’s time. But if anyone is interested in how to present video content in Softr where the source is Xano, which has to be done via embed of another CMS (since Softr doesn’t support Xano), please reach out to me directly and I’ll be happy to share.
Thx