<html>
<body id="inParent">
<script>
function sendMessage(msg) {
return new Promise(resolve => {
window.addEventListener(
"message",
(event) => resolve(event.data),
{once: true});
document.getElementById("iframe").contentWindow.postMessage(msg,"*");
});
}
function create_iframe(src) {
var ifrm = document.createElement("IFRAME");
ifrm.setAttribute("id", "iframe");
ifrm.setAttribute("name", "iframe");
ifrm.setAttribute("src", src);
document.body.appendChild(ifrm);
}
</script>
</body>
</html>