943,918 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Mar 2nd, 2005
0

iframe height

Expand Post »
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!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ipodgirl is offline Offline
7 posts
since Mar 2005
Mar 2nd, 2005
0

Re: iframe height

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
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Mar 3rd, 2005
0

Re: iframe height

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ipodgirl is offline Offline
7 posts
since Mar 2005
Mar 3rd, 2005
0

Re: iframe height

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
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Mar 18th, 2005
0

Re: iframe height

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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shiznatix is offline Offline
1 posts
since Mar 2005
Mar 21st, 2005
0

Re: iframe height

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...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ipodgirl is offline Offline
7 posts
since Mar 2005
Apr 11th, 2006
0

Re: iframe height

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lars-hilse is offline Offline
2 posts
since Apr 2006
Apr 11th, 2006
0

Re: iframe height

Hi,

Did you try this one already?:
http://www.dyn-web.com/dhtml/iframes/height.html
Reputation Points: 14
Solved Threads: 1
Junior Poster in Training
Esopo is offline Offline
50 posts
since Feb 2006
Apr 11th, 2006
0

Re: iframe height

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lars-hilse is offline Offline
2 posts
since Apr 2006
Apr 12th, 2006
0

Re: iframe height

Well, yes, some things are quite a mess. I'm particularly worried about your unclosed
HTML and CSS Syntax (Toggle Plain Text)
  1. <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:
HTML and CSS Syntax (Toggle Plain Text)
  1. <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:
HTML and CSS Syntax (Toggle Plain Text)
  1. <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.
Reputation Points: 14
Solved Threads: 1
Junior Poster in Training
Esopo is offline Offline
50 posts
since Feb 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: divs overlapping on browser resize
Next Thread in HTML and CSS Forum Timeline: absolute positioning text over header image





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC