Take the 2-minute tour ×

I seem to be having an iFrame resize issue with Google Chrome.

 function resizeIframe(obj)

   obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';



That's in my header.

> <iframe id="content" name="content" frameborder="0" scrolling="no" width="950px" src="html/index2.html" onload='javascript:resizeIframe(this);'></iframe> <

That is my iframe script.

So what I'm trying to do is to resize the iFrame dynamically per page content, and it works flawlessly in Firefox & IE, but not Chrome. What gives? Any ideas guys?

Thanks in advance.

share|improve this question
add comment

2 Answers

It appears that this is a bug with chrome. Why can't you use clientHeight for now instead of scrollHeight?

share|improve this answer
Thanks for the quick reply! Tried that and it didn't work in chrome, yet again. I'm a bit of a noob with it comes to javascript and im trying to use a setTimeout because my recent research suggests something about chrome loading the javascript too fast? I can't seem to get the setTimeout to work! –  IOWA Oct 10 '10 at 2:09
add comment

You could do this:

<iframe src="your url" width="your widthpx" height="your heightpx"></iframe>
share|improve this answer
add comment

Your Answer


