How to Open Link in New Tab in Javascript
Posted on: February 18, 2021 by Ariessa Norramli
In this article, you will learn how to open a link in a new tab in Javascript.
Let’s say you want to open a link to the code-source.tempurl.host’s homepage.
https://code-source.tempurl.host/
In order to open a link in a new tab, you can use the window.open()
method.
window.open("https://codesource.io/");
Note: The window.open()
method functions by opening the supplied link in a new tab or window, depending on your browser configuration.
Share on social media
//