This page was translated from English by the community. Learn more and join the MDN Web Docs community.

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.

Метод document.close() завершает запись в документ, открытый с помощью document.open().

Синтаксис

document.close();

Пример

// открытие документа для записи в него.
// запись содержимого документа.
// закрытие документа.
document.open();
document.write("<p>The one and only content.</p>");
document.close();

Спецификации

Specification
HTML
# dom-document-close-dev

Совместимость с браузерами