Solved

Iframe height adjust to remote page content

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now