Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: HTML Web-Development
I have a web page and wish to autorefresh some of the content.
 
I currently am using:
<meta http-equiv="refresh" content="60" > 
 
This refreshes the whole page every minute, which is functionally ok.
 

However I have an iframe on the page and it is only the content of this iframe that I want to auto refresh.
 
What is the simplest way to do this?
Posted 4-Feb-12 7:26am
Dalek Dave432.9K
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

CG is right. Alternatively you may use Javascript setTimeout so dynamically you may refresh the iframe
  Permalink  
Comments
Dalek Dave at 4-Feb-12 13:00pm
   
Thanks, it seems that you cannot put a meta tag in an iframe and the way to do it is as I have edited about, using setTimeout as you seuggested.
Espen Harlinn at 8-Feb-12 19:11pm
   
5'ed!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Aha...
 
Thanks to Thatraja for his suggestion of setTimeout...
 
Here[^] is where I found salvation after having the setTimeout pointer.
  Permalink  
Comments
Christian Graus at 4-Feb-12 13:25pm
   
You should know better than to post this as an answer..... Yes, the meta tag is something I've never used, if it didn't work, the other solution was to do it the old fashioned way
Dalek Dave at 4-Feb-12 13:36pm
   
Answer what way?
 
I just used the "I have solved this myself" button.
I didn't post as an "Answer".
Dalek Dave at 4-Feb-12 13:36pm
   
As for the old fashioned way, you have to remember I am an accountant, so a lot of the "old fashioned ways" are the "new fangled ways" :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Put that tag inside your iframe page.
  Permalink  
Comments
Dalek Dave at 4-Feb-12 12:40pm
   
I refuse to accept that it is that simple!
 
Is that it?
 
Really?
Dalek Dave at 4-Feb-12 12:47pm
   
OK tried it and it says that Meta cannot be nested in an iframe.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

I'm a month late for the discussion, but Graus is right. It has to work (the meta inside the frame's html)
Here's a sample.
Save this one as page.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
  <div style="padding:25px;">
    <script>document.write(Date().toString());</script><br/>
    <iframe src="frame.htm" title="frame title"></iframe>
  </div>
</body>
</html>
& this one as frame.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="2" >
</head>
<body>
<script>document.write(Date().toString());</script>
</body>
</html>
Fire the page.htm & you'll see the refresh.
 
However this is not viable if the frame's html is used as another stand alone page & you do not want to insert the 'meta refresh' inside it.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Mathew Soji 334
1 Maciej Los 295
2 BillWoodruff 290
3 Afzaal Ahmad Zeeshan 257
4 DamithSL 225
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,045


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 5 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100