Skip to content
Related Articles

Related Articles

How to redirect a page to another page in HTML ?

View Discussion
Improve Article
Save Article
  • Last Updated : 16 Dec, 2021

In this article, we will know how to redirect a page to another page in HTML, along with understanding its implementation through the examples.

Approach: To redirect from an HTML page to another page, you can use the <meta> tag by specifying the particular link in the URL attribute. It is the client-side redirection, the browsers request the server to provide another page. It also uses the http-equiv attribute to provide an HTTP header for the value of the content attribute. The value in the content attribute is specified in seconds, for the page to be redirected after. For immediate loading, you can set it to 0. Some browsers don’t correctly render the refresh tag. Here, the user may see a message before the next page loading. Some old browsers don’t correctly refresh when you add such quick links. In that case, you should add an anchor link to let the user follow to the next page.

Syntax:

<meta http-equiv = "refresh" content = " time ; url = link"/>

Example: This example describes redirecting the page to another page by specifying the URL link in the <meta tag>.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>HTML Redirect</title>
    <meta http-equiv="refresh" content="5; url =
    https://ide.geeksforgeeks.org" />
</head>
  
<body>
    <h1 style="text-align:center;color:green;">
    GeeksforGeeks
  </h1>
    <p style="text-align:center;">
        If your browser supports Refresh, 
        you'll be redirected to GeeksforGeeks 
        Homepage, in 5 seconds. 
    </p>
  
</body>
  
</html>

Output:

Redirecting the page to another page

Supported Browsers:

HTML is the foundation of web pages, is used for webpage development by structuring websites and web apps. You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!