HTML DOM open() Method

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP







<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->



HTML DOM open() Method


❮ Document Object



Example


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



document.open();
document.write("<h1>Hello World</h1>");

document.close();

Try it Yourself »

More "Try it Yourself" examples below.



Definition and Usage


The open() method opens an output stream to collect the output from any
document.write() or
document.writeln() methods.


Once all the writes are performed, the
document.close() method causes any output written to the output stream to be
displayed.


Note: If a document already exists in the target, it will be cleared.


Note: Do not confuse this method with the
window.open() method, which opens a new browser
window.



Browser Support














Method
open() Yes Yes Yes Yes Yes

Syntax



document.open(MIMEtype, replace)

Parameter Values








Parameter Description
MIMEtype Optional. The type of document you are writing to. Default value is "text/html"
replace Optional. If set, the history entry for the new document inherits the history entry from the document which opened this document




<!--
mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]
-->




Technical Details




Return Value: No return value

More Examples



Example


Using parameters; Open an output stream, add some text, then close the output stream:



document.open("text/html", "replace");

document.write("<html><body><p>Hello World!</p></body></html>");
document.close();

Try it Yourself »



Example


Using window.open() together with document.open() to open an output stream in
a new window, add some text, then close the output stream:



var
w = window.open();

w.document.open();

w.document.write("<h1>Hello World!</h1>");

w.document.close();

Try it Yourself »



❮ Document Object

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)