I have to use redirects a lot in my scripts, for example after a user logs in I need to redirect them to the admin area, etc. But I find it inconvenient to always have to have the header function at the very top. So if I use the meta refresh tags for my redirects, is that something that would be frowned upon according to best practices or is it acceptable?
function redirect($location) {
echo "<meta http-equiv='refresh' content='0; url=$location' />";
}
No. The Wikipedia clearly states:
Meta refresh is a discouraged method of instructing a web browser to automatically refresh the current web page or frame after a given time interval.....
Meta refresh tags have some drawbacks:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With