Window name attribute

Definition and usage

name Set or return the name of the window attribute.

Tip:The window does not need to have a name.

Instance

Example 1

Get window name:

let name = window.name;

Try it yourself

Example 2

Set window name:

window.name = "myWindowName";

Try it yourself

Example 3

Open a frame with a special name:

const otherWindow = window.open();
otherWindow.name = "Butterfly";

Try it yourself

Syntax

Return name attribute:

window.name

Set name attribute:

window.name = winName

Halaga ng Atribute

Halaga ng Atribute Paglalarawan
winName Ang pangalan ng window.

Babalik na Halaga

Uri Paglalarawan
String

Ang pangalan ng window.

Kung walang pangalan ang window, ibabalik view.

Suporta ng Browser

Lahat ng mga browser ay sumusuporta window.name:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Suporta Suporta Suporta Suporta Suporta Suporta