Document: close() method
Deprecated
Avoid using this feature in new projects.
The dynamic markup insertion API, which includes document.write(), has "very idiosyncratic behavior" which can be difficult to debug.
This feature may be a candidate for removal from web standards or browsers.>
Consider using the following features instead: DOM.>
The Document.close() method finishes writing to a
document, opened with Document.open().
Syntax
js
close()
Parameters
None.
Return value
None (undefined).
Examples
js
// Open a document to write to it
document.open();
// Write the content of the document
document.write("<p>The one and only content.</p>");
// Close the document
document.close();
Specifications
| Specification |
|---|
| HTML> # dom-document-close-dev> |