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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…