View Full Version : how to check a window is open in another jsp

09-02-2008, 08:54 PM
Hi everyone,

i have a question which im trying to solve

in jsp1,"onClick" of link im opening in a new window
href="#" onclick="JavaScript:popupOpen('<%=URLString%>','winName1');"><%=strName%></a>

function popupOpen(winURL,winName) {
winName1 = window.open(winURL,winName);

in jsp1or jsp2 or jsp3 i have a logout link at the top of the page,when i click logout link in any jsp it redirects to logout page and i also want the window which is opened to be closed.

how can i do this,
how to check a window is open or not in another jsp and if that window is open close it.

Help needed

Advance Thanks to all

09-03-2008, 12:54 AM
Well, you don't even have to do that!! All you would need to do is, in the onload section on the body, place a setTimeout function so that after five seconds, the window can close with window.close(). This is all you need to do: in the onload part of the body tag, place this in it: setTimeout("window.close()",5000); This makes the window close after five seconds. There is no need to check if it is open. Hope I helped.


09-03-2008, 01:47 AM
thanks for ur reply,

but i dont close the window after a time out.

when a user click logout link,the same page redirects to logoutURL and the new window which is open shud close.