html open link in new tab Edit

Murugan Andezuthu Dharmaratnam | 05 September 2020 | 99

if you want to open a link in the new tab set the 'target' attribute of the link to _blank

Open link in new tab

<a href="http://4beginner.com/html-open-link-in-new-tab" target="_blank">Open link in new window</a>                
                    

depending on the browser setting the link will open in a new window or new tab. You will not be able to set whether it opens in a new window or a new tab.

Javascript code to open link in new window

You can write javascript code to open link in a new window. you can also specify the size of the new window.

<a onclick="window.open('http://4beginner.com/html-open-link-in-new-tab','name','width=400,height=400')">Open link in new window</a>

Click on the link below to see the link open in a new window

Open link in new window