Quantcast
Viewing latest article 2
Browse Latest Browse All 28

Answer by iMath for Resizing an iframe based on content

If you have control over the iframe content , I strongly recommend using

ResizeObserver

Just insert the following at the end of srcdoc attribute of iframe ,escape it if needed.

<script type="text/javascript">var ro = new ResizeObserver(entries => {  for (let entry of entries) {    const cr = entry.contentRect;    // console.log(window.frameElement);    window.frameElement.style.height =cr.height +30+"px";  }});ro.observe(document.body);</script>

Viewing latest article 2
Browse Latest Browse All 28

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>