semplicemente richimando la funzione
window.name()
Stai attento però che tutte le nuove finestre aperte dal browser non hanno proprieta name. Sarebbe corretto aprire le finestre con apposita funzione che dichiari anche il nome (js ver. 1.1)
Codice PHP:
<html>
</head>
<script language="JavaScript">
function detectFocus() {
alert(window.name)
}
</script>
<body onload="javascript:window.name='Finestra principale'">
<input type="button" value="Pulsante" name="B1" onClick="detectFocus()">
</body>
</html>