>Probably better to use .insertAdjacentHTML() :
https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML.
.insertAdjacentHTML() inserts the HTML with afterbegin inside the div I wish to replace the innerHTML with. So, at first, I clear it. Then, I replace it.
loDiv=parent.document.getElementById("IFrameContainer")
loDiv.innerHTML=''
loDiv.insertAdjacentHTML('afterbegin',document.body.innerHTML)
This makes the page to look ok. However, the content of the form is not parsed as complete HTML tags. Thus, when posting, only the form values in their initial state is posted. What I change in the form is ignored.
beforeend inserts the HTML at the same place. Because I clear the div innerHTML at first, beforeend would result in the same as the first approach.
beforebegin inserts the HTML but breaks my page. Nothing is even posted to the server.
afterend inserts the HTML at the end of the page. Nothing is even posted to the server.