1

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

> <script language="javascript" type="text/javascript">
 function resizeIframe(obj)

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


     }
 </script>

<

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.

Igor
  • 33,276
  • 14
  • 79
  • 112
IOWA
  • 11
  • 2

2 Answers2

0

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

Alex
  • 64,178
  • 48
  • 151
  • 180
  • 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 02:09
0

You could do this:

<iframe src="your url" width="your widthpx" height="your heightpx"></iframe>
Anthony
  • 12,177
  • 9
  • 69
  • 105