This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

open

Method of dom/Documentdom/Document

Syntax

var object = object.open(url, name, features, replace);

Parameters

url

Data-type
any

name

Data-type
BSTR

Note The following applies only if this method is used instead of window.open.

features

Data-type
BSTR

Note The following applies only if this method is used instead of window.open.

replace

Data-type
any

Return Value

Returns an object of type DOM NodeDOM Node

Object

document

Examples

The following example shows how to use the open method to replace the current document with a new document and display the HTML markup contained in the variable sMarkup.

<html>
<head>
<title>First Document</title>
<script>
function replace(){
    var oNewDoc = document.open("text/html", "replace");
    var sMarkup = "<html><head><title>New Document</title></head><body>Hello, world</body></html>";
    oNewDoc.write(sMarkup);
    oNewDoc.close();
}
</script>
</head>
<body>
<h1>I just want to say</h1><br>
<!--Button will call the replace function and replace the current page with a new one-->
<input type ="button" value = "Finish Sentence" onclick="replace();">
</body>
</html>

Notes

Remarks

When a function fired by an event on any object calls the open method, the window.open method is implied.

<script language="JScript">
function myOpen() {
    open('about:blank');}
</script>
<body onclick="myOpen();">
Click this page and window.open() is called.
</body>

Syntax

Standards information

See also

Related pages

Attributions