I've been trying to integrate content of another page with an iframe. This is the best approach of a source-code I could find for this implementation.
<script>
function resizeIframe(iframe) {
iframe.style.height = iframe.contentWindow.document.documentElement.scrollHeight + 'px';
}
</script>
<iframe src="https://another-backend-domain.com/bnt" frameborder="0" width="100%" onload="resizeIframe(this)"></iframe>
The problem is here, that the onload function is recognized as cross-origin. With pages on the same domain, this method works just fine...
Uncaught DOMException: Blocked a frame with origin "https://original-website.com" from accessing a cross-origin frame.
at resizeIframe (https://original-website.com/site/:239:42)
at HTMLIFrameElement.onload (https://original-website.com/site/:241:112)
I would be glad, if anyone could help me out with this, as even after many hours of research I still can't figure out a good way to fix this. The default height of my iframe is just too small, but I can't manually define the height in px, because the content height is changed hourly...