0

Hi

I am doing a chating application.I want to know whether a window is opened or not.
This is the code i am using to open a window.

var title='Chat_'+userId+"_"+selectedUserId;

var url="OneToOneChat.aspx?FromUserId="+userId+"&FromUserName="+userName+"&ToUserId="+selectedUserId+"&ToUserName="+selectedUserName;

                window.open(url,title,'width=410,height=400,toolbar=no,menubar=no,scrollbars=no,status=yes',false);

later i trying whether the window is already opened or not.

var win='Chat_'+userId+"_"+selectedUserId;
if(win.closed)
{
}
else
{
}

for win.closed it is giving javascript error like "closed is null or not an object".

I am using IE7.

Please h on this.

Thanks in Advance

Venki

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by ankitjain_dce
0

Oh i think problem might be u r opening the window w/o assigning it to a variable.....fifth line above should be:
var win=window.open(url,title,'width=410,height=400,toolbar=no,menubar=no,scrollbars=no,status=yes',false);

There is no need for new win var in the second javascript code and u can directly for win.closed.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.