Window name Property - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window name


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

Set the name property with the following Values

Value Type Description
winName String Sets the name of the window

Return Value

A String, representing the name of the window.

If the name is not specified, this property returns "view"

The following code shows how to create a window with the open() method, and return the name of the new window:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {/* w w w .j  a  v a 2  s  .  c  o  m*/ = "myWindowName";
    var x = "This window's name is now: " +;
    document.getElementById("demo").innerHTML = x;


Related Tutorials