close method
Closes an output stream and forces the sent data to display.
![]() |
Syntax
var retval = document.close();Parameters
This method has no parameters.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Standards information
Remarks
When a function fired by an event on any object calls the close method, the window.close method is implied.
<script type="text/ecmascript">
function myClose() {
close();
}
</script>
<body onclick="myClose();">
Click this page and window.close() is called.
</body>
When an event on any object calls the close method, the document.close method is implied.
Note When document.write or document.writeln is used in an event handler, document.close should also be used.
<button onclick="window.close();"> Click this button to close the window. </button>
See also
Show:
