HTML Redirect To Another Page On Load
Last Updated : Jan 1, 2023
IN - HTML
In this tutorial we will show you the solution of HTML redirect to another page on load, many times we see that when we click on a link and want to open a particular webpage of website by typing it, browser redirects us to its home page or another parent page.
So, in this article we will understand how to redirect to another page in html on load.
Step By Step Guide On HTML Redirect To Another Page On Load :-
As, here are many ways with help of which we can redirect to another page on load. Let us understand them one by one with the codes given below.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>html redirect to another page on load </title> <meta http-equiv="refresh" content="0; url=http://demo.com/" /> </head> <body> <script> window.location.href = "http://www.talkercode.com"; </script> </body> </html>
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
- Here, then we create a body tag. All the content which we want to show on browser’s screen or display is always written inside this codes.
- One thing more here as you see in the head tag. We use meta tag there, and this tag also used to redirects to another webpage on load. This tag is always used inside the head tag of current webpage.
- And inside content attribute we have to give value using URL. As you can see that inside URL we give the value like https://demo.com you are able to give the value of that page where we want our webpage to redirect.
- Mostly as you see our further languages that are used with html. There are many inbuilt functions and methods that are used in that language to redirect html page to another page. We hope that you understand these steps easily.
- At last, the <body> and <html> tags are closed with </body> and </html> respectively.
At last in conclusion, here we can say that with the help of this article we are able to understand how to redirect to another page on load using html.
I hope this tutorial on HTML redirect to another page on load helps you and the steps and method mentioned above are easy to follow and implement.