Categories
JavaScript Answers

How to programmatically open new pages on tabs with JavaScript?

Spread the love

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'.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *