window.open - Checking if window already exists

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   window.open - Checking if window already exists
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
Hi.... again...

I was wondering how you check ( with javascript duh ) if a window is already open, and if its open, dont open it, and if it isnt open it, i've tried a lot, but i cant seem to get the right code.

Hope someone can help icon_smile.gif

Gareth




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#2   re: window.open - Checking if window already exists
GoddsEgo
PayPal Donation
CZ Moderator
GoddsEgo has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Jun 26, 2003
0.16 posts per day
Posts: 1211
Points: 69,166
 Yahoo Messenger  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<\script language="javascript" type="text/javascript">

var New1;

function OpenNew1() {
if (!New1) {
New1 = window.open("http://www.codezwiz.com/forums-getdaily.html","","");
} else {
New1.focus();
}
}

<\/script>


</head>
<a href="#" onClick="OpenNew1()">Codezwiz</a>
<body>
</body>
</html>



Back to top Reply with quote
#3   re: window.open - Checking if window already exists
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
It still refreshes icon_eek.gif

Gareth




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#4   re: window.open - Checking if window already exists
GoddsEgo
PayPal Donation
CZ Moderator
GoddsEgo has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Jun 26, 2003
0.16 posts per day
Posts: 1211
Points: 69,166
 Yahoo Messenger  
tested in Mozilla, NN, Opera, Maxthon and Ie on 2 different computers and it works fine for me.




Back to top Reply with quote
#5   re: window.open - Checking if window already exists
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
Would it make any difference if using it with body onload? because thats what im doing, heres what i've got

<\script language="javascript" type="text/javascript">

var New1;

function OpenNew1() {
if (!New1) {
New1 = window.open("/miniplayer.html","minipw","width=450,height=400,status=no,toolbar=no,menubar=no,scrollbars=auto");
} else {
New1.focus();
}
}

<\/script>
<body onload="OpenNew1()" oncontextmenu="return false">


btw i did edit the script tag so its not that lol

Gareth



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum