Window name attribute
- Previous Page moveTo()
- Next Page navigator
- Go to the Previous Level Window Object
Definition and Usage
name
Sets or returns the name of the window.
Tip:The window does not need to have a name.
Instance
Example 1
Get the window name:
let name = window.name;
Example 2
Set the window name:
window.name = "myWindowName";
Example 3
Open a frame with a special name:
const otherWindow = window.open(); otherWindow.name = "Butterfly";
Syntax
Return the name attribute:
window.name
Set the name attribute:
window.name = winName
Attribute Value
Attribute Value | Description |
---|---|
winName | The name of the window. |
Return Value
Type | Description |
---|---|
String |
The name of the window. Returns if the window has no name |
Browser Support
All Browsers Support window.name
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support | Support |
- Previous Page moveTo()
- Next Page navigator
- Go to the Previous Level Window Object