Skip to content

Closing a browser tab using JavaScript

To close a browser tab we can user window.close() method.

Advertisements
window.close();//closes the current browser tab without any warnings.

window.close() will close the browser tab without any warnings. You can choose to show an alert to let the user know there are unsaved changes.

See also  Strange Counter - Hackerrank Challenge - Java Solution
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.