I have two servers ( for example: localhost:3000 and http://example.com ).
In the localhost, I have an iframe that is connected to http://example.com ( through src attribute ), so I've sawed a lot of answers that showed how to get data, but I didn't saw any that showed how to save it.
<!-- localhost:3000 -->
<iframe src="http://example.com" id="example"></iframe>
<script>
let iframeCONTENT = null;
// ^^^^ how do I fill this variable with the content of iframe
let iframe = document.querySelector("#example");
let iframeDocument = iframe.contentWindow || iframe.contentDocument || iframe.contentDocument;
iframeDocument.postMessage("", "*")
</script>
<!-- http://example.com -->
<h1>Hello World!</h1>
<p>Blabla!</p>
<script>
window.addEventListener("message", (e) => {
console.log(document.body)
}, false)
</script>