resizing iframe height according to its content in firefox

V

visu

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=FramePageHeight;

can any one help for firefox?
Thanx in advance.

Regards
Visu
 
L

Larry Marburger

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=FramePageHeight;

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
 
T

totalstranger

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=FramePageHeight;

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/dynamicindex17/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').contentDocument.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').contentDocument.body.scrollHeight)
do something
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top