Home > Net >  Open a link in a new window
Open a link in a new window

Time:10-04

When you click on the link, the link opens on the same page, and the main link opens in a new window

If the primary link is https://www.google.com and the clicked link is https://www.youtube.com

The youtube link is opened on the same page, and the main link, which is google, opens in a new window, which is what the user sees when clicking

CodePudding user response:

I hope these are enaugh for you,

window.open(targeturl, '_self'); //current tab
window.open($(location).attr("href"), '_blank'); //new tab

CodePudding user response:

If you want to open a link in a new tab use the target attribute https://www.w3schools.com/tags/att_a_target.asp

  • Related