iframe height not adjusted when clicking on link inside of iframe
See original GitHub issueI’m using iFrame Resizer to embed a cross domain iframe on a page. This works well, until I click on a link inside of the iframe that takes me to the next page.
In the iframe source page (the remote one) I’ve got the following code in the header:
<script src="https://cdn.jsdelivr.net/npm/iframe-resizer@3.6.1/js/iframeResizer.contentWindow.min.js"></script>
In the page that’s embedding the iframe I’ve got:
<iframe id="crelate-iframe" src="https://foo.bar" frameborder="0" width="100%" scrolling="no">
</iframe>
and in the footer of the page:
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/iframe-resizer@3.6.1/js/iframeResizer.min.js?ver=1'></script>
<script>
(function($) {
$(function() {
$('#crelate-iframe').iFrameResize({
log: true,
heightCalculationMethod: 'lowestElement'
});
});
})(jQuery);
</script>
The logging doesn’t give away much as far as I can tell. I can only see it initially adjusts the height of the iframe, but when I click through it doesn’t and when the next page’s height is smaller I end up with a bunch of white-space at the bottom.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
I can not adjust the iframes height - Stack Overflow
Basically all the elements whose display is "block" will expand itself horizontally all it cans, but will set its height to whatever it...
Read more >How to adjust the width and height of iframe to fit with content ...
Another way set the height and width of the iframe to fit with content is to use resize property of CSS, this method...
Read more >Automatically Adjust iFrame Height According to its Contents ...
You can use the JavaScript contentWindow property to make an iFrame automatically adjust its height according to the contents inside it, so that...
Read more >3 Ways to Resize iFrames in HTML - wikiHow
1. Open up your HTML file. HTML files have a the file extension ".html" or ".htm" after the file name. You can edit...
Read more >From object to iframe — other embedding technologies
<iframe> s are for embedding other web pages, and the other two allow you to ... This provides a way to embed an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please have a look at parent div and all DOM elements inside iFrame that might not shrink themselfe I was facing same behavior but was able to remove it with
html, body, .body{ min-height:0; }
If you have the script on every page, down sizing problems are always down to CSS