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