How to automatically transfer visitors to a new web page ?
This article is all about how can we transfer our web page visitors to another web page. This may be required in cases when need to do a temporary change in our website or we have permanently shifted our website to a new website. We can use this method to automatically redirect our users or tell search engines by redirecting them to the new site.
Approach: There are so many methods in HTML to do this but we are going to talk about meta tags. It is the simplest and easiest way to automatically transfer your web page to any URL.
<meta http-equiv="refresh" content="0; url='https://www.geeksforgeeks.org/'" />
Parameters: The<meta> tag needs three attributes for redirecting the user to another page as shown below:
- http-equiv: This is used for instructing a web browser to automatically refresh the current web page.
- content: This is used to specify how much delay you want to redirect to a new page.
- url: This is used to tell in which web page we have to forward our old website.
The below examples will demonstrate the use of the <meta> tag to redirect the pages.
Example 1: This code will redirect our web page to the GeeksforGeeks website after 2 seconds.
Example 2: This code will redirect our web page to Google after 2 seconds.