How to redirect to another page after 5 minutes?
15,799
Solution 1
If you really want to use PHP for this, here you go:
<?php header("Refresh: 300; URL=http://www.stackoverflow.com/"); ?>
Solution 2
With just HTML:
<meta http-equiv="refresh" content="300;http://redirect-url" />
This will redirect to http://redirect-url
after 300 seconds (5 minutes).
Solution 3
Javascript's setTimeout() is probably what you want. An example would be:
setTimeout(function(){ window.location = "<URL HERE>";}, 5*60*1000);
window.location is what you can use in javascript to set the current location of the window. Something to consider, however, is that most browsers do not let you set window.location without some type of user input before hand, such as a click.
See here
Author by
bsanneh
Updated on June 17, 2022Comments
-
bsanneh almost 2 years
How do I redirect to another page after 5 minutes using PHP?
-
bsanneh over 13 yearsthnx @Will Charczuk but my time is taking less than a minute when i use this one..
-
bsanneh over 13 yearsthnx guys really appreciate ur help
-
Will Charczuk over 13 yearstry substituting 5*60*1000 with 300000