Sometimes, we want to programmatically open new pages on tabs with JavaScript.
In this article, we’ll look at how to programmatically open new pages on tabs with JavaScript.
How to programmatically open new pages on tabs with JavaScript?
To programmatically open new pages on tabs with JavaScript, we call the window.open
method with '_newtab'
.
For instance, we write
window.open("page.html", "_newtab");
to open page.html with window.open
.
We open the page in a new tab by calling it with '_newtab'
as the 2nd argument.
Conclusion
To programmatically open new pages on tabs with JavaScript, we call the window.open
method with '_newtab'
.