Esta página ha sido traducida del inglés por la comunidad. Aprende más y únete a la comunidad de MDN Web Docs.

View in English Always switch to English

Document.close()

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.

El método document.close() finaliza la escritura de un documento abierta con document.open().

Sintaxis

js
document.close();

Ejemplo

js
// Abrir un documento.
// Escribir contenido en el documento.
// Cerrar el documento.
document.open();
document.write("<p>El único contenido.</p>");
document.close();

Especificaciones

Specification
HTML
# dom-document-close-dev

Compatibilidad del Navegador