Close a window in JavaScript

Description

The following code shows how to close a window.

Example


<!--  w  w w . ja  v  a2s.  c  o  m-->
<!DOCTYPE HTML>
<html>

<body>
<script>
//window.close();

</script>
</body>
</html>

Click to view the demo

The code above generates the following result.

Close a window in JavaScript