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?
There is nothing wrong with using the meta refresh tag.
That tag says wait 5 seconds and redirect to example.com. This tag isn't a problem unless users are on IE6 and it still works, just breaks the history buttons.
Using JavaScript is an option, but make sure you include a link saying "If you are not automatically redirected, please click here". You should actually include that link either way.
Header tags are sent on page load, to the browser, so that it can quickly redirect the user to the desired page without bothering to render it or even load it into the history. As such, you can't call a redirect once the page has already loaded, as the headers have already been dealt with.
You can instead perform this with:
Which basically sets the
<meta>
tag in the headers of the page itself, meaning you don't need to write the tag out.Try use "refresh" header:
Also, you can look at this Question Refresh HTTP Header.
php way to set header, will redirect you to test.php in 5 seconds:
call before any actual output is sent.
And in javascript:
You can do it with a small piece of javascript:
Of course, this will depend on the person having JavaScript enabled.
Obviously, to set the delay you can use something like setTimeout:
https://codingislove.com/redirect-pages-php/
check out the above article, where they clearly explained about how to redirect the pages in PHP by setting time.
Redirecting code without time set: header('location:URL ADDRESS');
Redirecting code with three seconds time set: header('refresh:3; url=URL ADDRESS');