I have 2 vhosts setup with different subdomains; x.domain.com and y.domain.com. I'm rendering iframes from x in y. So issues rendering and displaying the iframe but getting cannot access the iframe contents. I have no headers set at the moment and tried to solve it with csp but couldn't get around the error.
x.domain.com/frame.html:
<html>
<body>
</body>
<script>
function myFunc() {
console.log('called');
}
</script>
</html>
y.domain.com:
let iframe = (iframe_element.contentWindow || iframe_element.contentDocument);
if (iframe.document) iframe = iframe.document;
iframe.myFunc();
postMessage is not option as I can't modify iframe contents.