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.
- How to redirect to another webpage 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 email@example.com. 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.