davidjbradshaw/iframe-resizer

I didn't understand the "Usage" chapter in the documentation and need help

Opened this issue · 2 comments

I am having hard time understanding the Usage chapter in the documentation.

I didn’t figure out what to do after downloading and extracting the zip in my web application root.

I have tried to load the iframe as follows but it isn't dynamically resized, what have I done wrong?

<html>
	<body>
		<iframe id="myIframe" src="https://hanekudai.com/pjcrcf/index.php"></iframe>
		<script src="/iframe-resizer/js/iframeResizer.contentWindow.min.js"></script>
		<script>
			const iframes = iFrameResize({ log: true }, '#myIframe');
		</script>
	</body>
</html>

You must use iframeResizer.min.js on the page that includes the iframe. iframeResizer.contentWindow.min.js must be included on the page that is loaded inside the iframe.

@markvantilburg thanks, now I got it to work.

Code in the webpage that includes the iframe

<html>
	<body>
        <script src="/iframe-resizer/js/iframeResizer.min.js"></script>
		<iframe id="myIframe" src="https://hanekudai.com/pjcrcf/index.php"></iframe>
		<script>
			const iframes = iFrameResize({ log: true }, '#myIframe');
		</script>
	</body>
</html>

Code in the page that is loaded inside the iframe (index.php)

<!DOCTYPE html>
<html>
	<head>
		<! -- All head code -->
	</head>
	<body>
		<! -- ALL body code PLUS the line below -->
	<script src="/iframe-resizer/js/iframeResizer.contentWindow.min.js"></script>
</html>