Forum Moderators: open
What I want to do is to check if a popup-window is already open, and if so, it shouldn't load up a new version of the same popup. Yes, I know it can be done simply by just giving the same name to the window. The trouble is that this particular window can be named as either name1 or name2 (long story).
So is there a way to get the value of the window? Something along the lines of
if ( window.name == name1 ) { [...] }
else if ( window.name == name2 ) { [...] } Of course, this is just pseudo code. Help would be greatly appreciated, as always. =)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Window hijinks 05-12-04</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var winx=false;
</script>
</head>
<body>
<p>
<a href="javascript:winx=window.open();top.focus();">Open a window</a>
</p>
<p>
<a href="javascript:winx.document?alert('win open'):alert('no win');">check win</a>
</p>
</body>
</html>
There is a closed property that could do it:
[webreference.com ]