469,309 Members | 2,789 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,309 developers. It's quick & easy.

resizing iframe height according to its content in firefox

Hi ,
I need a solution for my problem with IFRAME in firefox.

The problem is that i ve to make the IFRAME to increase in its height
to displays its whole content dynamically .i ve set scrolling=0 ,i
dont want the scroll bars to appear in the IFRAME.

I ve achieved this somehow thru javascript in IE.. but it is not
working in Firefox.. is there anyway to increase the height of the
IFRAME dynamically depends on its content in FIREFOX?

The code worked for me in IE is

var FramePageHeight =
document.getElementById('iframeID').scrollHeight;
document.getElementById('iframeID').style.height=F ramePageHeight;

can any one help for firefox?
Thanx in advance.

Regards
Visu

Feb 28 '07 #1
3 18331
visu wrote:
I ve achieved this somehow thru javascript in IE.. but it is not
working in Firefox.. is there anyway to increase the height of the
IFRAME dynamically depends on its content in FIREFOX?
http://developer.mozilla.org/en/docs...ontent#1021468

br | rb
Feb 28 '07 #2
On Feb 28, 12:41 am, "visu" <k.vis...@gmail.comwrote:
Hi ,
I need a solution for my problem with IFRAME in firefox.

The problem is that i ve to make the IFRAME to increase in its height
to displays its whole content dynamically .i ve set scrolling=0 ,i
dont want the scroll bars to appear in the IFRAME.

I ve achieved this somehow thru javascript in IE.. but it is not
working in Firefox.. is there anyway to increase the height of the
IFRAME dynamically depends on its content in FIREFOX?

The code worked for me in IE is

var FramePageHeight =
document.getElementById('iframeID').scrollHeight;
document.getElementById('iframeID').style.height=F ramePageHeight;

can any one help for firefox?
Thanx in advance.

Regards
Visu
I assume you've checked the value of FramePageHeight and it's 0. In
Firefox you need to tack on "px" when you set style.height to a pixel
value. For example:
document.getElementById("iframeID").style.height = FramePageHeight +
"px";

- Larry

Feb 28 '07 #3
On or about 2/28/2007 12:41 AM, it came to pass that visu wrote:
Hi ,
I need a solution for my problem with IFRAME in firefox.

The problem is that i ve to make the IFRAME to increase in its height
to displays its whole content dynamically .i ve set scrolling=0 ,i
dont want the scroll bars to appear in the IFRAME.

I ve achieved this somehow thru javascript in IE.. but it is not
working in Firefox.. is there anyway to increase the height of the
IFRAME dynamically depends on its content in FIREFOX?

The code worked for me in IE is

var FramePageHeight =
document.getElementById('iframeID').scrollHeight;
document.getElementById('iframeID').style.height=F ramePageHeight;

can any one help for firefox?
Thanx in advance.

Regards
Visu
If you are not going cross-domain then look at
http://www.dynamicdrive.com/dynamici...iframessi2.htm

It seems the DOM varies in FF and IE7 for the IFRAME document data or
I've just not found the magic words. I've not found any solution for
cross-domain IFRAMEs because the browsers restrict getting the height of
the foreign document, or anything else for that matter.

FF
var FramePageHeight =
document.getElementById('iframeID').contentDocumen t.body.scrollHeight;
IE7
var FramePageHeight =
document.getElementById('iframeID').Document.body. scrollHeight;

or just do a simple if
if (document.getElementById('iframeID').Document.body .scrollHeight)
do something
else
if document.getElementById('iframeID').contentDocumen t.body.scrollHeight)
do something
Mar 1 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Paul Fi | last post: by
3 posts views Thread by PCgeek | last post: by
2 posts views Thread by jerryyang_la1 | last post: by
1 post views Thread by knkk | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.