Get window name:
let name = window.name;
Try it Yourself »
Set window name:
window.name = "myWindowName";
Try it Yourself »
More examples below.
The name
property sets or returns the name of the window.
A windows does not need to have a name.
Return the name property:
window.name
Set the name property:
window.name =
winName
Type | Description |
winName | The name of the window. |
Type | Description |
A string | The name of the window. Or "view" (If the window has no name). |
Open a frame with a special name:
const otherWindow = window.open();
otherWindow.name = "Butterfly";
Try it Yourself »
window.name
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!