Hi Troy,

There is another way, just for your reference

When you do a window.open you specifie a name 
Ie. Window.open('url','WinName','options')

You can then check if open by the following

If (WinName != null)
 {
  if (WinName.closed)
    {
     //reopen code here
    }
    else
    {
     WinName.focus();
    } 
  }

Take care,

Ben Johansen - http://www.pcforge.com
Authorized Witango Reseller http://www.pcforge.com/WitangoGoodies.htm 
Latest downloads & List Archives @ http://www.witango.ws

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Troy Sosamon
Sent: Wednesday, October 09, 2002 11:17 AM
To: Multiple recipients of list witango-talk
Subject: RE: Witango-Talk: Javascript Window Detection

Works like a champ,  this is working code:
        function winopen(url,name,params)
                {
                try{
                        clientwin.focus();
                        }
                catch(e){
                        clientwin = window.open(url,name,params);
                        }
                }
Thanks
Troy

===== Original Message from [EMAIL PROTECTED] at 10/09/02 11:41
am
>Hi Troy,
>
>Try:
>
>try{
>    clientwin.focus();
>}catch(e){
>    return false;
>}
>
>This is a built in method for JavaScript (since 1.0?) to get around
>potential errors your script may generate. Instead of the 'return
false'
>you can insert other code to do all kinds of things, as well as have
nested
>'try' statements.
>
>I find this feature invaluable in JavaScript. I believe it is
cross-browser
>and works with most versions of Netscape, but I do know that it doesn't
>work in MSIE 4.0
>
>Hope this helps. Cheers...
>
>
>----- Original Message -----
>From: "Troy Sosamon" <[EMAIL PROTECTED]>
>To: "Multiple recipients of list witango-talk"
<[EMAIL PROTECTED]>
>Sent: Wednesday, October 09, 2002 11:29 AM
>Subject: Witango-Talk: Javascript Window Detection
>
>
>> I need some help with a javascript.
>> I am opening a new window with the statement:
>>
>> clientwin = window.open(url,name,params);
>>
>> and it works just fine.
>>
>> I need to be able to detect if the window is already open or not,
because
>if
>> it is already open, I just want to set focus to the window and not
reload
>> it.  I can set focus to the window with:
>> clientwin.focus()
>>
>> How can I do this without getting the error that says clientwin is an
>> undefied object?
>>
>> Thanks,
>> Troy Sosamon
>>
>>
________________________________________________________________________
>> TO UNSUBSCRIBE: send a plain text/US ASCII email to
[EMAIL PROTECTED]
>>                 with unsubscribe witango-talk in the message body
>
>_______________________________________________________________________
_
>TO UNSUBSCRIBE: send a plain text/US ASCII email to
[EMAIL PROTECTED]
>                with unsubscribe witango-talk in the message body

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to