How to open a window in a new tab with JavaScript?

Spread the love

Sometimes, we want to open a window in a new tab with JavaScript.

In this article, we’ll look at how to open a window in a new tab with JavaScript.

How to open a window in a new tab with JavaScript?

To open a window in a new tab with JavaScript, we use the window.open method.

For instance, we write

window.open("https://example.com", "_blank");

to call window.open with the URL to open andb '_blank' to open the URL in a new tab.

Conclusion

To open a window in a new tab with JavaScript, we use the window.open method.

Leave a Reply

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