window.close() Method in Window Object of Javascript Syntax with Examples
2694 Views
Usage
The Close() method is used to close the window.
Syntax
webpage.close();
Example
<button onclick="javascript:showwindow();">Close</button>
var webpage = window.open("http://www.knowledgewalls.com","","width=800,height=300");
function showwindow(){
webpage.close();
}
Output
Once we run the run, it will display the webpage.We can use "close" button to close the window.