Dynamic iframe resize woes in google chrome
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.
It appears that this is a bug with chrome. Why can't you use clientHeight for now instead of scrollHeight?
You could do this:
<iframe src="your url" width="your widthpx" height="your heightpx"></iframe>
精彩评论