Hi!
I would like to have an iframe take as much vertical space as it needs to display its content and not display a scrollbar. Is it at all possible ?
Are there any workarounds?
Thanks in advance
home / developersection / forums / making an iframe take vertical space
Hi!
I would like to have an iframe take as much vertical space as it needs to display its content and not display a scrollbar. Is it at all possible ?
Are there any workarounds?
Thanks in advance
AVADHESH PATEL
13-Feb-2013Hi Pravesh!
This should set the IFRAME height to its content's height:
<script type="text/javascript"> var height = document.getElementById('the_iframe').contentWindow.document.body.scrollHeight; document.getElementById('the_iframe').height = the_height; </script>You may want to add scrolling="no" to your IFRAME to turn off the scrollbars.