View Full Version : Cross browser, cross domain iframe resizing script

06-18-2009, 07:50 PM
Is there any way to resize an iframe dynamically to the height of its content that works cross browser and works when the iframe content is on another domain than the main page (I have access to both pages, so code can be put in either)
Also, it must resize when links in the iframe are clicked (ie when a new page within the iframe is loaded)

06-18-2009, 10:09 PM
you could try getting the scroll height and width of your body element then resizing the content window.

height = document.body.scrollHeight;
width = document.body.scrollWidth;
document.contentWindow.height = height;
document.contentWindow.width = width;