Refresh iFrame?

mpg187

Up-and-Coming Sensation
Joined
Apr 5, 2010
Messages
483
Reaction score
0
FP$
6
operation420 net

On that page I have http://operation420 net/test.php?style=9 embedded. Is there a code I can put outside of the iFrame that refreshes the page, but only the iFrame (Because that's the only part of the page that is likely to change often...)
 
IF you're running the server - why not use AJAX & PHP & JavaScript to get it to do it dynamically?
iFrames are old hat - and shouldn't REALLY be used unless vital & no other solution.

How often do you want it to reload? 😵
 
I don't know how to use AJAX.

I want it to refresh when a user clicks a link. But could I make it refresh automatically?
 
mpg187 said:
I don't know how to use AJAX.

I want it to refresh when a user clicks a link. But could I make it refresh automatically?

Clicks what link? What is the point in the link? 🙂
 
You could forget the javascript and just add a meta refresh on the iframe page:


<META HTTP-EQUIV="refresh" CONTENT="5">

where 5 is the amount of seconds between each refresh
 
Wrighty said:
Clicks what link?
The link I would make.

Although auto refresh would be cool though. Is there a way I can make the refresh interval go up after time? Because if someone leaves the tab open it would eat up bandwidth, but if at first it refreshes every 5 seconds, but after a few times it goes up to a minute and the maybe 5 minutes the longer someone leaves the tab open, the longer it waits to refresh. And if they come back after a while, they can manually refresh...
 
Seeing as the file is PHP, could try this:

Iframe URL:

http://operation420.net/test.php?counter=1

Then in test.php have something like:
PHP:
<span class="syntaxhtml"><br /><span class="syntaxdefault"><?php<br /><br />$counter </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> $_GET</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'count'</span><span class="syntaxkeyword">];<br /><br /></span><span class="syntaxdefault">$timeout </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 5</span><span class="syntaxkeyword">;<br /><br /></span><span class="syntaxcomment">// set timeout based on count<br />// e.g.<br /><br /></span><span class="syntaxdefault">$timeout </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 5 </span><span class="syntaxkeyword">*</span><span class="syntaxdefault"> $counter</span><span class="syntaxkeyword">;<br /><br /></span><span class="syntaxcomment">//  First refresh =  refresh after 5 seconds<br />//  Second refresh = refresh after 10 seconds<br />//  Third refresh = refresh after 15 seconds, etc.<br /><br /></span><span class="syntaxdefault">$counter&nbsp;&nbsp;</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault">?><br /></span><br /><meta http-equiv="refresh" content="<span class="syntaxdefault"><?php echo $timeout</span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> ?></span>;url=test.php?count=<span class="syntaxdefault"><?php echo $counter</span><span class="syntaxkeyword">;</span><span class="syntaxdefault"> ?></span>"><br /></span>
 
So iFrame http://operation420.net/test.php?counter=1 (Actually http://operation420.net/test.php?style=9&counter=1, because I only have it setup on Style 9, too lazy to do it to all, especially since the Recent Posts on the homepage is in "beta")

and put that code in?

So the code would them goto counter=2, then counter=3 the next time and time after?
 
Back
Top Bottom