Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Redirect Page in PHP after a few seconds without meta http-equiv=REFRESH CONTENT=time

It seems that it is not advisable to use

<meta http-equiv=REFRESH CONTENT=3;url=url>

for redirects but instead use

header('Location: url')

However, I would like to show the user some message and allow them some time to read it before redirecting. Is there a way to do it without meta?

like image 396
zhenming Avatar asked Jun 22 '12 10:06

zhenming


People also ask

How do I automatically redirect a page after 5 seconds?

To redirect a webpage after 5 seconds, use the setInterval() method to set the time interval. Add the webpage in window. location. href object.

How do I redirect a page after 10 seconds?

To redirect from an HTML page, use the META Tag. With this, use the http-equiv attribute to provide an HTTP header for the value of the content attribute. The value of the content is the number of seconds; you want the page to redirect after. Through this, you can automatically redirect your visitors to a new homepage.

How do I redirect after delay?

If you want to redirect a page automatically after a delay then you can use the setTimeout() method in JavaScript and it will call the above property after a time delay. The solution is very simple. The setTimeout() method will call a function or execute a piece of code after a time delay (in millisecond).

How automatically redirect to another page in PHP?

PHP 301 Redirect To set a permanent PHP redirect, you can use the status code 301. Because this code indicates an indefinite redirection, the browser automatically redirects the user using the old URL to the new page address.


1 Answers

Try use "refresh" header:

header('Refresh: 3;url=page.php');

Also, you can look at this Question Refresh HTTP Header.

like image 67
Dador Avatar answered Oct 17 '22 02:10

Dador