Last Updated : Jan 1, 2023
So, let us understand the window.open() method with help of the help of codes given below.
- In previous tutorials, we already many times create a full code example in which we first create an HTML form with its basic structure. Inside that structure, we use HTML, head, title, body, and script tags.
- So, let us first see the syntax of the window.open() function. window.open(URL, name, specs, replace)
- As we see above that there are some parameters required which are used in the window.open() function. So, let us see the parameters once. First of all the above parameters are optional and we are going to use only two of them. The first one is the URL and another is the name.
- Inside the URL we have to give the value of the link which are want to open in a new tab. For example, in our above example, we use the talker’s Code homepage URL. When we click the button given above.
- The URL is the path or webpage, a route that we want to open in a new tab that opens by clicking the button.