How to redirect to another page after 5 minutes?

How to redirect to another page after 5 minutes using PHP?

+8
javascript html php timer
source share
4 answers

If you really want to use PHP for this, you are here:

<?php header("Refresh: 300; URL=http://www.stackoverflow.com/"); ?> 
+13
source share

Only with HTML:

 <meta http-equiv="refresh" content="300;http://redirect-url" /> 

This will be redirected to http://redirect-url after 300 seconds (5 minutes).

+11
source share

Javascript setTimeout () is what you want. An example is:

 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. However, it should be borne in mind that most browsers do not allow you to set window.location without any user input before starting work, for example by clicking.

Look here

+5
source share

How to redirect page after 5 minutes using php

You can not; PHP runs on the server, not on the client. After you display the web page to the client, you have no control over the page. An event with javascript, you can not guarantee that the user will redirect, because they can always not allow javascript or just leave your page.

After retrieving the webpage, you can set a timeout to redirect the user using javascript: see all other answers.

+1
source share

All Articles