JavaScript Document Object : close() method
Description
The close() method is used to close a stream opened with the document.open() method.
Version
Implemented in JavaScript 1.0
Syntax
close()
Parameter
None
Example of document Object : close() method
The following web document demonstrates how the close() method can be used.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>JavaScript document Object - close() method</title>
</head>
<body>
<h1 style="color: red">JavaScript document Object : close() method</h1>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[
mywin=window.open("") //Create a blank window
mywin.document.open() //open document stream
mywin.document.write("We are learning close() method")
mywin.document.close()
//]]>
</script>
</body>
</html>
View the example of document object's close method in the browser
Supported Browser
| Internet Explorer 7,8 | Firefox 3.6 | Google Chrome 7 | Safari 5.0.1 | Opera 10 |
| Yes | No | No | No | No |
See also :

