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.