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 |
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:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w w w .j a v a 2 s . c o m*/ window.name = "myWindowName"; var x = "This window's name is now: " + window.name; document.getElementById("demo").innerHTML = x; } </script> </body> </html>