Window name

Examples

Get window name:

let name = window.name;
Try it Yourself »

Set window name:

window.name = "myWindowName";
Try it Yourself »

More examples below.


Description

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

Note

A windows does not need to have a name.


Syntax

Return the name property:

window.name

Set the name property:

window.name = winName

Property Value

Type Description
winName The name of the window.

Return Value

Type Description
A stringThe name of the window.
Or "view" (If the window has no name).


More Examples

Open a frame with a special name:

const otherWindow = window.open();
otherWindow.name = "Butterfly";
Try it Yourself »

Browser Support

window.name is supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.