View Full Version : browser window not resizing with iframe in mozilla

04-13-2005, 01:55 PM
hello..this is my first time posting on this forum - im always grateful for any assistance - thank you in advance.

i am using the following script to auto resize an iframe according to the height of the content being loaded into it. the actual resizing of the iframe is happening fine in ie and mozilla, however in mozilla the browser height is not adjusting to the new height of the iframe once a button is clicked. so if there has been a long page with a lot of content that had to scroll quite a bit, and you click on a link to a page which has less content in, there is a huge space left after the bottom of the site..

in internet explorer its working perfectly.

here is the code i am using:

in the head of the index page which contains the navigation links and the iframe.

// Dynamic Iframe loader
function loadIframe(theURL) {

// resizes Iframe according to content
function resizeMe(obj){
docHeight = mainContent.document.body.scrollHeight
obj.style.height = docHeight + 'px'

on the iframe itself, located in the index page:

<iframe id="mainContent" name="mainContent" onload="resizeMe(this)" style="width:420px; z-index:0; overflow:hidden" frameborder="0" src="home.html"></iframe>

and then on each of the links:

<a href="javascript:loadIframe('home.html')">home</a>

If someone could help me here i would greatly appreciate it. thanks again in advance.