I am continuously getting the error "Error: Permission denied to access property 'document'"
while i have already define in my X-FRAME options
to allow the other domain, like this..
<?php
header('X-Frame-Options: ALLOW-FROM http://mydomain.com');
?>
Below is the header of iframe request, clearly shows i have defined to allow the domain to access the iframe but not working. All i want is to resize the iframe using javascript.
Here is my javascript code to resize the iframe height.
<iframe src="http://mydomain.com/xxx/yyy" id="idIframe" onload="iframeLoaded();" allowtransparency="true" frameborder="0" width="100%" scrolling="no"></iframe>
<script type="text/javascript">
function iframeLoaded() {
var iFrameID = document.getElementById('idIframe');
if(iFrameID) {
iFrameID.height = "";
if(iFrameID.contentWindow.document.body.scrollHeight < 500) {
iFrameID.height = "500px";
} else {
iFrameID.height = iFrameID.contentWindow.document.body.scrollHeight + "px";
}
}
}
</script>
How can i do this? Please suggest.
X-Frame-Options
determines if a page is allowed to be displayed inside a frame. It doesn't grant cross-origin JS permission. – Dilator