How to close a tab window with a confirmation dialogue in Javascript

To close a tab window with a confirmation dialogue in Javascript you can use the following snippet.

Sample JS

function CloseTab() {
  if (confirm("Do you want to close this Window?")) {
    close();
  }
}

Please Share us:
Please rate this snippet

2 thoughts on “How to close a tab window with a confirmation dialogue in Javascript

Leave a Reply