Window close() method
Window Object
Definition and Usage
The close() method is used to close a browser window.
Syntax
window.close()
Browser support





All major browsers support the close() method.
Example
Example
The example below can close a new browser window:
function openWin(){
myWindow=window.open("","","width=200,height=100");
myWindow.document.write("
This is 'my window'
");}
function closeWin(){
myWindow.close();
}
Try it »
Window Object