How to redirect from a HTML page?



Share on Google+Share on Google+

Java Coder
How to redirect from a HTML page?
3 Answer(s)      3 years and 10 months ago
Posted in : HTML


Is it possible to redirect from HTML page to another page on the net? I have one page and I want to redirect it to another page. What will be the code for redirecting the page to another page when use visits the first page.


View Answers

October 8, 2013 at 10:35 PM

Yes, Its possible to redirect to another page using HTML code. You can use the following code:

<meta http-equiv="refresh" content="0; url=">

The tag <meta http-equiv="refresh" />is used to refresh the browser after specified interval. Following code will refresh the page after 60 seconds:

<meta http-equiv="refresh" content="60">

This is one of the easiest way to refresh the page or redirect one page to another page.

Hope above code will help you.

View more tutorials at HTML tutorial index page.


October 8, 2013 at 10:41 PM


JavaScript can also be used to redirect the page to another page.

Here is the complete code example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HEAD>Example of HTML page redirect</TITLE>
        <script language="JavaScript">
        window.location.href = ""

  <P><a href=''>Click here to visit another page</a></p>

Here we are using window.location.href = ""for redirecting to another page.

When page loads JavaScript is executed and page is redirected to


October 8, 2013 at 10:47 PM


Another option is to use the HTTP 301 redirect. This solution is based on the Server Side solution of redirect. The Sever instruct the browser that the resource is permanently move to another url.

Client requests for the a resource on server:

GET /mypage.php HTTP/1.1

Server response:

HTTP/1.1 301 Moved Permanently

You can use the following code in your Servlet for this purpose:


Here is an example of Send Redirect in Servlet.



Related Tutorials/Questions & Answers: