Solved: iFrame 'Loses' html content after several minutes

Update: The problem was with Chrome. After I de-installed chrome and wiped out all traces of data, including extensions, and reloaded Chrome, it’s working fine.
Hope this helps somebody in the future…
Tom

I have a vanilla HtmlComponent which displays html content correctly for several minutes, then loses the html altogether.

Here is the HtmlComponent source:

<!doctype html>
<html>
<head>
<script type="text/javascript">

window.onmessage = (event) => {
if (event.data) {
  document.getElementById("content").innerHTML = event.data;
  }
};

function sendLoadMessage () {
window.parent.postMessage("LoadOk", "*");
}
</script>
</head>
<body onload="sendLoadMessage ();">
<div id="content"></div>
</body>
</html> 

here is the wix page source:

export function html1_message(event) {
    $w("#html1").postMessage(htmlcontent);
    $w("#html1").show();
}

the html loads via postMessage, after waiting until a message is received from the html component ( picked up by Giri’s excellent thinking on this at https://girizano.wixsite.com/codecorner/post/html-component-not-running-in-publish-mode-google-sheets-example ), to ensure that the html component is ready to go.

The html looks great at first:

Then, after a few minutes, the screen turns to this:

I am using Chrome, and if I right click over the frame and select “Reload Frame”, the html reloads, and then after a few minutes disappears, with [object Object] in the htmlComponent.

???

Tom

2 Likes