X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Window name Property

Window Object Reference Window Object

Example

Create a window with the open() method, and return the name of the new window:

var myWindow = window.open("", "MsgWindow", "width = 200, height = 100");
myWindow.document.write("<p>This window's name is: " + myWindow.name + "</p>");

Try it yourself »


Definition and Usage

The name property sets or returns the name of the window.

This method is often used to modify the name of a window, after the window has been created.

Note: The name of the window is often used for setting targets for hyperlinks and forms. However, this is not required, as windows do not need to have names.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The name property is supported in all major browsers.


Syntax

Return the name property:

window.name

Set the name property:

window.name=winName

Technical Details

Return Value: The name of the window


More Examples

Example

Set the name of the window to "myWindowName":

window.name = "myWindowName";

Try it yourself »


Window Object Reference Window Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook