Open Link/URL in Same Tab/Window or New Tab in HTML & JS
In HTML, utilizing the target="_blank" attribute ensures that the link opens in a new tab.
In JavaScript, if you want to open a link in the same tab or window, you can do so by setting window.location to the new URL, effectively replacing the current page. On the other hand, to open a link in a new tab, you can utilize the window.open() method and specify the target as "_blank".
In JavaScript, if you want to open a link in the same tab or window, you can do so by setting window.location to the new URL, effectively replacing the current page. On the other hand, to open a link in a new tab, you can utilize the window.open() method and specify the target as "_blank".
Share
share your add link
https%3A%2F%2Fmycode.blog%2Flakshmi%2Fopen-linkurl-same-tabwindow-or-new-tab-html-js%0A
Share in social
Comments