Error when Dynamically Resizing iFrame using iframe-resizer

482 Views Asked by At

I am trying to dynamically resize the height of an iFrame using "iframe-resizer" However this is not working as expected.

I have added this code to my display HTML document

<script src="js/iframeResizer.min.js"></script>
<iframe id="myIframe" src="l3-main.html"></iframe>
<script>
   iFrameResize({ log: true }, '#myIframe')
</script>  

and this code to my iframe content HTML document

<script type="text/javascript" src="js/iframeResizer.contentWindow.min.js"></script>

as well as this in my css file

iframe {
    width: 1px;
    min-width: 100%;
    border: none;
}

However, I am getting this error when viewing the page in the Console:

Uncaught ReferenceError: iFrameResize is not defined

Searching though stackoverflow and other resources I have not yet been able to find a solutions, thanks in advance to anyone who has sugestions.

2

There are 2 best solutions below

2
honza On

maybe you dont have install min.js code. You use code like code in documentation, but you dont use a <style> with 1px width and min width 100%.

0
David Bradshaw On

The code in the question is correct. I would check that the JS file is loading ok.