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.
Definition and Usage
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 string | The 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 | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |