3.3.1
Opening the input stream

Causes the Document to be replaced in-place, as if it
was a new Document object, but reusing the previous
object, which is then returned.

If the type argument is omitted or has the
value "text/html", then the resulting
Document has an HTML parser associated
with it, which can be given data to parse using document.write().
Otherwise, all content passed to document.write()
will be parsed as plain text.

If the replace argument is present and has
the value "replace", the existing entries in
the session history for the Document object are removed.

This method has very idiosyncratic behavior. In
some cases, this method can affect the state of the HTML
parser while the parser is running, resulting in a DOM that
does not correspond to the source of the document (e.g. if the
string written is the string "<plaintext>" or "<!--").
In other cases, the call can clear the current page first, as if
document.open() had been called.
In yet more cases, the method is simply ignored, or throws an
exception. To make matters worse, the exact behavior of this method
can in some cases be dependent on network latency, which can lead to failures that are very hard to debug.
For all these reasons, use of this method is strongly
discouraged.