I'm trying to close the current browsing window in JavaScript. I've tried the following code. It works in Chrome and Safari, but doesn't in Firefox.
var win = window.open('', '_self', '');
win.close();
I'm trying to close the current browsing window in JavaScript. I've tried the following code. It works in Chrome and Safari, but doesn't in Firefox.
var win = window.open('', '_self', '');
win.close();
 
    
     
    
    You will need JavaScript to do this. Use window.close():
function close_window() {
  if (confirm("Close Window?")) {
   close();
  }
}
HTML:
<a href="#" onclick="close_window();return false;">close</a>
 
    
    