Solved

Iframe height adjust to remote page content

Posted on 2009-05-06
5
917 Views
Last Modified: 2012-05-06
Hi there.

I have an html page that contains an iframe which shows content from another website. I need the iframe to height adjust based on the content height.  I found a solution in the knowledge base - http://www.experts-exchange.com/Q_22701504.html -  that works beautifully for IE but does not work at all for Firefox. I was wondering if it could be modified to work in FF or another solution could be provided. I have provided the code below.
<-- HTML PAGE --->
 
  <iframe name="myframe1" src="css-js/getremotefile.php?loc=http://www.msn.com" align="top" width="690" height="2000" frameborder="0" scrolling="no" marginheight="0"> </iframe> 
 
 
 
<--- getremotefile.php ----->
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
 
<body>
<?php
  readfile($_GET['loc']);
?>
</body>
</html>

Open in new window

0
Comment
Question by:allisonsabo74
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:ycTIN
ID: 24322171
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24324745
Which of the solutions in the other question did you try that did not work in FF?
0
 

Author Comment

by:allisonsabo74
ID: 24325022
ycTIN:

I looked at the link, tried the solution. It did not work.

mplungjan:
I used the solution posted by hach-que at 17/07/07 08:07 PM. The solution works in IE but not Firefox. Here it is below.
As for remote sites, you can use :

getremotefile.php :
<?php
  readfile($_GET['loc']);
?>

Then just tell the IFRAME to goto getremotefile.php?loc=http://www.remotesite.com
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 24325202
You need BOTH solutions.

Why would IE resize to content and FF not when you have no code that resizes the iframe???
0
 

Author Comment

by:allisonsabo74
ID: 24327437
mplungjan:
How right you are! I did have the other code in an external js file. Since it wasn't working I changed that code to the javascript mentioned on Dynamic Drive (http://www.dynamicdrive.com/dynamicindex17/iframessi.htm) and used it in conjunction with getremotefile.php. And here is my iframe code. it works perfectly in both FF and IE.
Thanks for making me take a closer look!

 <iframe id="myframe1" src="css-js/getremotefile.php?loc=http://www.externalsite.com" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:hidden; display:none;" width="690" scrolling="no" ></iframe>

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question