Reputation: 2283
I am trying fit a iframe that is linked with a search, so i can get a iframe result between 0px and 9750px in height depending on search properties. How can i make the height dynamical? I have tried getting the table properties inside the iframe but without success.
Basically i want to know how to get the height of the content I get from the iframe. Not the iframe itself.
<script type="text/javascript">
function iframeLoaded() {
var iFrameID = document.getElementById('idIframe');
if(iFrameID) {
// here you can make the height, I delete it first, then I make it again
iFrameID.height = "";
iFrameID.height = iFrameID.contentWindow.document.body.scrollHeight + "px";
}
}
</script>
When I try to do this i get this eror "Uncaught DOMException: Blocked a frame with origin "http://localhost:52191" from accessing a cross-origin frame."
Upvotes: 0
Views: 1873
Reputation: 801
you can't get the iframe size because cross domain issue , but i think this library can solve the problem. iframe-resizer
Upvotes: 1