Categories
JavaScript Answers

How to close current tab in a browser window with JavaScript?

Spread the love

Sometimes, we want to close current tab in a browser window with JavaScript.

In this article, we’ll look at how to close current tab in a browser window with JavaScript.

How to close current tab in a browser window with JavaScript?

To close current tab in a browser window with JavaScript, we call the window.close method.

For instance, we write

window.close();

to close the current tab.

Conclusion

To close current tab in a browser window with JavaScript, we call the window.close method.

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 *