Easy Tutorial
❮ Met Win Setinterval Prop Date Readonly ❯

HTML DOM open() Method


Definition and Usage

The open() method opens an output stream to collect content output by methods such as document.write() or document.writeln().

After calling the open() method to open a new document and setting the document content with the write() method, it is essential to remember to close the document with the document.close() method, which forces the content to be displayed.

Note: If the target file already exists, it will be cleared. If this method has no parameters, it will display a new window (about:blank).

Syntax

Parameter Description
MIMEtype Optional. Specifies the type of document being written. The default value is "text/html".
replace Optional. When this parameter is set, it can cause the new document to inherit history entries from the parent document.

Browser Support

All major browsers support the open() method.


Examples

Example 1

Open an output stream and add text, then close the output stream:

Example 2

Open an output stream (a new window; about:blank), add text, then close the output stream:


❮ Met Win Setinterval Prop Date Readonly ❯