473,789 Members | 2,876 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getEle mentById('ifram eID').scrollHei ght;
document.getEle mentById('ifram eID').style.hei ght=FramePageHe ight;

can any one help for firefox?
Thanx in advance.

Regards
Visu

Feb 28 '07 #1
3 18560
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.getEle mentById('ifram eID').scrollHei ght;
document.getEle mentById('ifram eID').style.hei ght=FramePageHe ight;

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.getEle mentById("ifram eID").style.hei ght = 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.getEle mentById('ifram eID').scrollHei ght;
document.getEle mentById('ifram eID').style.hei ght=FramePageHe ight;

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.getEle mentById('ifram eID').contentDo cument.body.scr ollHeight;
IE7
var FramePageHeight =
document.getEle mentById('ifram eID').Document. body.scrollHeig ht;

or just do a simple if
if (document.getEl ementById('ifra meID').Document .body.scrollHei ght)
do something
else
if document.getEle mentById('ifram eID').contentDo cument.body.scr ollHeight)
do something
Mar 1 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7620
by: Thomas | last post by:
Hi there, I have an iframe which is editable (designMode = "on") and want to resize it dynamically as the content grows (e.g. more lines of text is in there) and there the struggle starts. I fill the iframe with content (<body> tag and so on and also insert a <div> tag, inbetween is the content that should be modified). Now if the event "overflow" or "underflow" is triggered the iframe
1
1777
by: Paul Fi | last post by:
I have this problem with iframes: i want to resize iframe's height when the window inside the frame is resized or when the src attribute of iframe changes so make the height of iframe equal to the size window's body scrollHeight so that way i dont need any scrolls for my iframe but the let page containing the iframe do the scrolling for the iframe so how can i make that happen, is one of the iframe events does detect any changes to...
1
10630
by: sam | last post by:
Hi all, Hope some expert can help me resolve this. I am using the following code to resize an iframe according to the content in it so that the iframe does not use its scroll bar and uses the parent window scroll bar. This code works perfectly fine in IE but not in Firefox.. The iframe does not resize according to the content. function resizeIframe(id)
3
4489
by: PCgeek | last post by:
sorry moved this over to javascript forum, didn't mean to post 2x! Hi guys, I'm trying to put the finishing touches on my website and could really use some help on this particular issue. My page includes background music with a javascript music player on the main page below an iframe that is used for all content and navigation of the site and so that the music doesn't reload each time a page is switched. There is another javascript to resize...
1
10386
by: Dave | last post by:
Usual apologies if this is old territory. I'm resizing a bunch of iframes on a page to the height of their contained documents. Some of the contained documents contain IMG tags. On IE this doesn't cause a problem and the resize works correctly. On Firefox, if an image extends below the last line of text in the document, that bit gets chopped off. In other words, the returned document height doesn't allow for the image. My code for...
2
3779
by: jerryyang_la1 | last post by:
Hi I'm trying to make an Iframe height adjustable depending on the height of the web page. I have managed to get this to work for the width, but not the height. The original code is available here: http://www.brainjar.com/css/tabs/ This is what I have:
1
3058
by: knkk | last post by:
Hi, I have an iframe that fetches content from a different domain. This is my URL, which has an iframe that fetches content from another site careerbuilder.co.in (this is a partnership channel, so they will co-operate if there are small things they need to do in their code, like putting something in the body tag or adding some script, though I would ideally like everything to be done in this page, and not in their pages). ...
9
2540
by: DL | last post by:
That is, for an iframe with onload attribute to preset a width and height then depending on the length of its content to auto-expand instead of scrolling. The following URL is quite interesting, http://www.phpmix.org/iframe_height_auto_resize, however, it failed to work for me, OS = XP w/ sp2; brower = IE7, but my app is quite complicated... it load the iframe inside a javascrip- driven window... And their forum has been closed, so, I...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.