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.
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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Identifiers and Keywords in TypeScript
- Data types in TypeScript
- DOM (Document Object Model)