How do I close a browser window with HTML code?
all browser compatibality
window.close(); not working
How do I close a browser window with HTML code?
all browser compatibality
window.close(); not working
See the second reply below for a discussion on when the window can be closed:
window.close and self.close do not close the window in Chrome
I'm quoting the answer of this question
Scripts are not allowed to close a window that a user opened. This is considered a security risk. Though it isn't in any standard, all browser vendors follow this (Mozilla docs). If this happens in some browsers, it's a security bug that (ideally) gets patched very quickly.
Use window.close() for close the window or tab in javascript
$(".close-btn").click(function(event) {
window.close();
});