Solved

Iframe height adjust to remote page content

Posted on 2009-05-06
5
919 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

765 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