how to refresh page only once?

YoutubeSlanger

Junior Member
Joined
Nov 9, 2011
Messages
184
Reaction score
22
okay I need to make a page refresh only once after a set time. I cant find a script for this just scripts that refresh every x amount of time.
 
Couldn't you just use a simple JS/meta refresh?
Code:
<script>
  ESPN_refresh=window.setTimeout(function(){window.location.href=window.location.href},900000);
</script>
<noscript>
  <meta http-equiv="refresh" content="900" />
</noscript>
 
Couldn't you just use a simple JS/meta refresh?
Code:
<script>
  ESPN_refresh=window.setTimeout(function(){window.location.href=window.location.href},900000);
</script>
<noscript>
  <meta http-equiv="refresh" content="900" />
</noscript>

you didnt read my post, I don't need it to refresh over and over again I need it to only fire off once and never again
 
Depending on you site, you could use a server side refresh where you use an if statement to keep it from refreshing. This way once the page is called it should refresh and send that variable through to keep it from refreshing again.

if($_GET['REFRESHVAR']<>1)
{
header( 'Location: http://www.yoursite.com/new_page.php?REFRESHVAR=1' ) ;}
 
Have you tried using imacro? It has a timer which you can set, then run the refresh command, which should only run once.
 
what Ridicule me said is right. Have you tried it i macro, it works fine for me. just check out.
 
There is also a nice Mozilla addon, which refreshes the page every x seconds.
 
If your using wordpress you could use Quick Page/Post Redirect plugin. But I don't think your using WP. I hope you find your answer.
 
If you don't have the option to fiddle with php, I've created a simple HTML example that works client side:

http://jsfiddle.net/WrPkd/7/

You just need jquery cookie and that's it;
you set the cookie RELOADED just after the first refresh and then you have to test its value; if RELOADED is set, the page is not refreshed.
I've binded this js function to a button, but you could easily trigger it when the page is loaded or after a given time.

Code:
$('#something').click(function() {
  if ($.cookie("RELOADED") == null){
   $.cookie("RELOADED",1);
   alert("I'm refreshing!");   
   location.reload();
  }else{
   alert("Don't refresh!");
  }
});
 
Last edited:
Back
Top