Window object property name in Javascript
The window object property name used to set and retrieve the name of the window. It returns a string that represents the name of the window or view, if name not specified.
Syntax
 1 window.name // to retrieve
 2 window.name = <string> // to set
string : A string specifies the name of the window
Window property name
 1 <!DOCTYPE html>
 2 <html>
 3 <style>
 4 .container {
 5   margin: 20px 0;
 6 }
 7 </style>
 8 <body>
 9 	<h1>The Window Object</h1>
 10 	<h2>The name property </h2>
 11 	
 12 	<div>
 13 	  <button onclick="setValue('Demo')">Demo</button>
 14 	  <button onclick="setValue('Example')">Example</button>
 15 	  <button onclick="access()">Access</button>
 16 	</div>
 17 	
 18 	<p id="result"></p>
 19 	<script>
 20 	function access() {
 21 	  const name = window.name;
 22 	  const str = `The window name is : <b>${name}</b>`;
 23 	  document.getElementById("result").innerHTML = str;
 24 	}
 25 	function setValue(value) {
 26 	  window.name = value;
 27 	}
 28 	</script>
 29 </body>
 30 </html>
Window property name
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us