User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 423,518 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,453 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 26300 | Replies: 13
Reply
Join Date: Mar 2005
Location: Atlanta
Posts: 7
Reputation: ipodgirl is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ipodgirl's Avatar
ipodgirl ipodgirl is offline Offline
Newbie Poster

Help iframe height

  #1  
Mar 2nd, 2005
Hi I'm trying to find a script that dynamically resizes the iframe to be the height of the page contained within it

The iframe page I am accessing is an external domain page.

I know due to security reasons normally all external pages loaded into the iframe must be from the same domain as the page the iframe tag is inserted. My twist is I can add codes to the external domain source page. I was wondering in this case is there a way to work around this issue so I can dynamically resize my parent iframe?

This is the closest thing I found, except it doesn't work for external pages on different domains.
http://www.dynamicdrive.com/dynamici...iframessi2.htm

Thanks much!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Posts: 354
Reputation: DanceInstructor is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 12
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: iframe height

  #2  
Mar 2nd, 2005
Not really the solution you are looking for, but you could use a php script to cache the pages locally on your server. What are you trying to do exactly. I would be very careful using content from someone elses sight in this way....

Dance
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote  
Join Date: Mar 2005
Location: Atlanta
Posts: 7
Reputation: ipodgirl is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ipodgirl's Avatar
ipodgirl ipodgirl is offline Offline
Newbie Poster

Re: iframe height

  #3  
Mar 3rd, 2005
Thanks for the tip. I don't know much about php but I will research...

Actually I'm trying to pull external content into my site - legally, of course. I do have the permission to do so from the external domain. Their page height fluctuates though, so I wanted to see if I can make my iframe height change dynamically to fix all of their content without scroll bar.

I guess I can just ask the external site people to give me an estimate of what their longest pages are, so I can set my iframe to the maximum height.
Reply With Quote  
Join Date: Feb 2005
Posts: 354
Reputation: DanceInstructor is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 12
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: iframe height

  #4  
Mar 3rd, 2005
This should work for you:
[PHP]<?php
// Edit these...
$page_to_cache = "http://www.theirdomain.com/pagetocache.html";
$page_to_write = 'mycachedpage.html';

// Do not edit below...
$cache = file_get_contents($page_to_cache);

$fh = fopen($page_to_write, 'wt');
fwrite($fh, $cache);
fclose($fh);

?>[/PHP]

You can contact your host to setup a cron job, or possibly do it in the cpanel.

Dance
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote  
Join Date: Mar 2005
Posts: 1
Reputation: shiznatix is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
shiznatix shiznatix is offline Offline
Newbie Poster

Re: iframe height

  #5  
Mar 18th, 2005
Is there a way to get the height of the iframe without catching the file (im using local websites in my iframe) but i want to resize a cell in my table to the height of the page in the iframe. is this possible?
Reply With Quote  
Join Date: Mar 2005
Location: Atlanta
Posts: 7
Reputation: ipodgirl is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ipodgirl's Avatar
ipodgirl ipodgirl is offline Offline
Newbie Poster

Re: iframe height

  #6  
Mar 21st, 2005
dance instructor> Thanks for the code. Our site doesn't work with cache (due to other code/database related issues) so we ended up just asking the external site to tell us their best guess of page height.

shiznatix> If you go to http://www.dynamicdrive.com/dynamici...iframessi2.htm the code there should help you - I think...
Reply With Quote  
Join Date: Apr 2006
Posts: 2
Reputation: lars-hilse is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
lars-hilse lars-hilse is offline Offline
Newbie Poster

Re: iframe height

  #7  
Apr 11th, 2006
I think it was already mentioned here but I am pulling out my hair as well...

My problem is, that I want the iframe to adapt the hight of the importet document WITHOUT there being scrollbars but the iframe adapting to the hight of the document.

My first tries went towards my coppermine gallery which is on THIS soul server in my house but yet under a different v-host. None the less... I read, that external URLs would not work because iframe couldn't figure out how high the imported document is...

Having read this I was rather demotivated but went ahead and built all the documents into the wwwroot which made them "local" BUT still no working iframe as I'd define it beacuse the doc - even when loaded locally - still has scroll bars to it.

Now I don't know what to do and where I went wrong and would be very happy, if anyone could help me out here.

Regards

Lars Hilse
Reply With Quote  
Join Date: Feb 2006
Posts: 49
Reputation: Esopo is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
Esopo Esopo is offline Offline
Light Poster

Re: iframe height

  #8  
Apr 11th, 2006
Hi,

Did you try this one already?:
http://www.dyn-web.com/dhtml/iframes/height.html
Site admin at NetBulge.com, a place set out to improve the web 1 good article at a time :)
Reply With Quote  
Join Date: Apr 2006
Posts: 2
Reputation: lars-hilse is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
lars-hilse lars-hilse is offline Offline
Newbie Poster

Re: iframe height

  #9  
Apr 11th, 2006
Yes... but I wasn't able to make it work... what else to I have to look upon while writing the script?

The page is located at http://hg2.serveftp.net/larhil2 - could be, that it is quite a mess by now.
Reply With Quote  
Join Date: Feb 2006
Posts: 49
Reputation: Esopo is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
Esopo Esopo is offline Offline
Light Poster

Re: iframe height

  #10  
Apr 12th, 2006
Well, yes, some things are quite a mess. I'm particularly worried about your unclosed
<body onload="goSetHeight()">

in the middle of the page, that is a HUGE no-no.

A web page can only have 1 <body> declaration, and your is a few lines back:
<body onload="MM_preloadImages('imagetank/button02.jpg','imagetank/button02-PHOTO.jpg','imagetank/button02-WEB.jpg','imagetank/button02-HOME.jpg')">

To have both onload requests merge you would want to delete the <body> in the middle of the page and change the first one to:
<body onload="MM_preloadImages('imagetank/button02.jpg','imagetank/button02-PHOTO.jpg','imagetank/button02-WEB.jpg','imagetank/button02-HOME.jpg'); goSetHeight()">


But before the goSetHeight() call can work, you first need to add to your page a goSetHeight() function declaration along with all the scripting found at the link I gave you.

I would also STRONGLY encourage you to remake the page from scratch. Some parts are terribly messy and are bound to hurt the render in one browser or the other.
Site admin at NetBulge.com, a place set out to improve the web 1 good article at a time :)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb HTML and CSS Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 4:58 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC