<!DOCTYPE html>
<html>
<body>
<p>Click the button to set the name of the window to "myWindowName".</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
window.name = "myWindowName";
var x = "This window's name is now: " + window.name;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>