I have a web page where a member can open up a chat window (child window) with another member.
- From there the member can also navigate to other web pages.
- From other pages in the site, they may also open up new chat windows with other members (just not the same one).
- Each chat page is opened with the member name as the window name.
- When I log off from the web page, I would like all the chat windows to automatically close.
I have tried to create an array to store the window references from the created chats but the problem is that once I navigate to a different page, the array is not persisted (as per the Javascript memory scope).
I have tried the solution offered in
However, this only works in IE and only for 1 open chat window. Once I have multiple chat windows up, it fails to close any of them. It also does not work for firefox with even 1 window.
Ideally, I would like to save each window reference back to the server as a session variable (using AJAX). I would store each reference in a session variable array. However, as a first step, I don't seem able to get the value of the window reference from within Javascript itself. When I try to examine the value (which I understand is a reference), I get '[object Window]'.
for example:
My Ajax related code is written in anticipation of this working (see below) but unfortunately, I am passing '[object Window]'
Does anyone know if this reference can be examined and I can get the value of this reference? I'm not even sure if my approach is even possible or if there is a better approach, so I am grateful for any advice.
Thanks.
- From there the member can also navigate to other web pages.
- From other pages in the site, they may also open up new chat windows with other members (just not the same one).
- Each chat page is opened with the member name as the window name.
- When I log off from the web page, I would like all the chat windows to automatically close.
I have tried to create an array to store the window references from the created chats but the problem is that once I navigate to a different page, the array is not persisted (as per the Javascript memory scope).
I have tried the solution offered in
However, this only works in IE and only for 1 open chat window. Once I have multiple chat windows up, it fails to close any of them. It also does not work for firefox with even 1 window.
Ideally, I would like to save each window reference back to the server as a session variable (using AJAX). I would store each reference in a session variable array. However, as a first step, I don't seem able to get the value of the window reference from within Javascript itself. When I try to examine the value (which I understand is a reference), I get '[object Window]'.
for example:
Code:
var newWin = open('chat.html', 'user1', ...) alert(newWin); // gives me a value of '[object Window]'
Code:
function trackOpen(newWin) { http.open('GET', 'windowmgmt.php?a=' + newWin); http.onreadystatechange = handleResponse; http.send(null); }
Does anyone know if this reference can be examined and I can get the value of this reference? I'm not even sure if my approach is even possible or if there is a better approach, so I am grateful for any advice.
Thanks.
Comment