Wednesday, December 18, 2019

Why Does Meta Refresh Not Work in Firefox?

If you are building a website which includes a login page and you need to redirect the user to their profile page once they've logged in successfully, but you don't know how to do that in PHP, this is the right solution for you.

I have a page using something along the lines of
<meta http-equiv="refresh" content="0;url=http://example.com/" />
It redirects in Chrome, but not in Firefox. Why not?

I've searched the internet and have been told that the meta refresh not work in Firefox.

Try to find out in Wikipedia.

Meta refresh is a method of instructing a web browser to automatically refresh the current web page or frame after a given time interval, using an HTML meta element with the http-equiv parameter set to "refresh" and a content parameter giving the time interval in seconds. It is also possible to instruct the browser to fetch a different URL when the page is refreshed, by including the alternative URL in the content parameter. By setting the refresh time interval to zero (or a very low value), meta refresh can be used as a method of URL redirection. (Wikipedia)

How to redirect to another page using PHP in Firefox?

Finally i found the solution from this link

I try to use the code below:
<?php
        echo "<script> location.href='http://example.com'; </script>";
        exit();
?>

it should work just fine but I still think the answer of the question "Why does Firefox not redirect using meta refresh?"

0 Comments

Post a Comment