💦 FULL SET: Multipage/dynamic markup insertion.html - HD Photos!
HTML
Living Standard — Last Updated 17 December 2025
8.4 Dynamic markup insertion
APIs for dynamically inserting markup into the document interact with the parser, and thus their behavior varies depending on whether they are used with HTML documents (and the HTML parser) or XML documents (and the XML parser).
Document objects have a throw-on-dynamic-markup-insertion counter,
which is used in conjunction with the create an element for the token algorithm to
prevent custom element constructors from being
able to use document.open(), document.close(), and document.write() when they are invoked by the parser.
Initially, the counter must be set to zero.
8.4.1 Opening the input stream
document = document.open()Support in all current engines.
Firefox1+Safari11+Chrome64+
Opera51+Edge79+
Edge (Legacy)12+Internet Explorer4+
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android47+-
Causes the
Documentto be replaced in-place, as if it was a newDocumentobject, but reusing the previous object, which is then returned.The resulting
Documenthas an HTML parser associated with it, which can be given data to parse usingdocument.write().The method has no effect if the
Documentis still being parsed.Throws an "
InvalidStateError"DOMExceptionif theDocumentis an XML document.Throws an "
InvalidStateError"DOMExceptionif the parser is currently executing a custom element constructor. window = document.open(url, name, features)Works like the
window.open()method.
Document objects have an active parser was aborted boolean, which is
used to prevent scripts from invoking the document.open()
and document.write() methods (directly or indirectly)
after the document's active parser has been aborted. It is initially false.
The document open steps, given a document, are as follows:
If document is an XML document