Below code takes an input url from the user and the url is stored in a variable through getElementById() and window.location takes the page to that url.
At first this will be the output, and then if the link like (https://www.geeksforgeeks.org/) is put inside the box, it will redirect to the home page of the GeeksforGeeks and will be shown like below.
Steps for executing above codes:
- Save these files with .html extension as file_name.html
- Then open the files in a browser, it will get redirect to the GeeksforGeeks homepage.
- ES6 | Page Redirect
- How to redirect to another webpage in HTML?
- How to use Meta Tag to redirect an HTML page?
- How to redirect a page to another page in HTML ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.