Solved

Iframe height adjust to remote page content

Posted on 2009-05-06
5
922 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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…

751 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