W3cubDocs

/DOM

document.close

The document.close() method finishes writing to a document, opened with document.open().

Syntax

document.close();

Example

// open a document to write to it.
// write the content of the document.
// close the document.
document.open();
document.write("<p>The one and only content.</p>");
document.close();

Specifications

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes ? Yes ? ? ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes ? Yes ? ? ?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/close