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 codesource.io’s homepage.
https://codesource.io/
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.
#code examples #javascript