Search code examples
htmlmeta

Meta-refresh doesnt work on mozilla and IE


I have a page and I refresh it every x second to find something in the data base, when it find i want to redirect to another page.

and im using this to redirect my page:

 echo "<meta http-equiv='refresh' content=1;url='login.html'>";

But this doesn't work on mozilla neither in IE.

Anyone can help me? (If you need any other information for help me I can provide)


Solution

  • Based on documentation at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta the HTML you're looking for is:

    <meta http-equiv="refresh" content="1;url=http://localhost/bn/login.html">
    

    which will redirect a user to http://website.com/login.html after 1 second.

    The important updates are where the quotes are for the content attribute, as well as having a full URL for the url= part of the instruction.

    Echoing this in PHP would be nearly identical:

    echo '<meta http-equiv="refresh" content="1;url=http://localhost/bn/login.html">';