Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the height of a page before including it in an iframe

Status
Not open for further replies.

Warlocks

Technical User
Jan 9, 2003
79
0
0
GB
Hi,

I am wanting to use an Iframe in a document but wish to automatically set the height of the Iframe to match the content height.
I do not want to use scroll bars and although I can guarantee the width can be fixed, I need some way of setting the height to equal the page height of the page to be displayed in the Iframe.

Any help would be great.

Warlocks.
 
Some problems you will encounter include having to wait until the iframe content is fully loaded before then testing the length and then setting the size of the iframe. There is no way to get this information accurately across all browsers (since IE5 for the Mac will thwart all attempts at determining if the source content was loaded).

Maybe you can find a better way to present your data - using javascript to modify the height of iframes doesn't seem the most natural way to approach this.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Hi Jeff,

I am mainly interested in IE only (probably just for PCs).
The issue I have is that I need a page that displays different pages but that looks like it is all on a single page to have just a single scroll bar for the entire page and not an individual one for each iFrame.

I would ideally like the iFrame to expand automatically to the size of the page contained within as this is all I need the information for (to set the height of the frame) but the information needs to come from a seperate page unrelated to the main page.

Cheers,

Warlocks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top