File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes  JSP page on closing the parent window the child windows should close automatically. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark " JSP page on closing the parent window the child windows should close automatically." Watch " JSP page on closing the parent window the child windows should close automatically." New topic
Author

JSP page on closing the parent window the child windows should close automatically.

sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear All,

How will we do in JSP page on closing the parent window the child windows should close automatically.

For Example::
Suppose in the prelogin(Not Post login page) the Login page is opening.Under the Login Page suppose Contact us link are thier.
My doubt is when we close the login page then if Contact us link is open then it will automatically close.

Please advise me for the above needful.

Thanks and Regards
Sumanta Panda
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Hi All,
Thanks a lot to Java Ranch.I got the solution with the help of Google.
function closeWin()
{
if(window.applnreq && window.applnreq.open && !window.applnreq.closed)
window.applnreq.close();
}

Regards
Sumanta Panda
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Just adding another link in case this shows up in a search.

Here is an example on closing multiple windows: http://radio.javaranch.com/pascarello/2005/01/19/1106152877000.html

[Glad you found a solution and posted it! Most people tend to not post the solution. Gold star!]

Eric
[ December 24, 2008: Message edited by: Eric Pascarello ]
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear Sir,
It is working for if the link is HTML,JSP if child link is pdf file then
the error comming Member not found.

Please i will show you my code.

For HTML link
function closeWin()
{
if(window.applnreq && window.applnreq.open && !window.applnreq.closed)
window.applnreq.close();
}
function showApplnFormWindow()
{

strURL = '<%=ApplicationStatusHTMLPath%>';
applnreq = window.open(strURL,"applnreq","height=450, width=650,scrollbars=yes,top=0,left=0,status=yes");
applnreq.focus();
}

For Pdf file i am using same code
function closeWin()
{
if(window.tradenpdfreq && window.tradenpdfreq .open && !window.tradenpdfreq .closed)
window.tradenpdfreq .close();
}
function showTradePDFWindow()
{

strURL = '<%=ApplicationStatusPath%>';
tradenpdfreq = window.open(strURL,"tradenpdfreq","height=450, width=650,scrollbars=yes,top=0,left=0,status=yes");
tradenpdfreq .focus();
}

But sir here error coming "MEMBER NOT FOUND".

Please i request anybody to rectify my code in pdf link case so that
i should not face "MEMBER NOT FOUND".

Thanks and Regards
Sumanta Panda
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
When is the error happening? When you open the window or when you close it?

if it is when you open it, might be an issue with the focus() being called too soon. Try adding a setTimeout("...focus()",300);

Eric
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear SIR,
when i click the pdf link first time it is opening.
But when i click again same pdf link in login page instead focus in the same pdf file it is showing "Member not found " Java script error.

But if the link is jsp file/HTML file then same code working perfectly.

I request all of you please guide me for the needful.

Regards
Sumanta
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I was able to recreate the bug in IE6. IE6 opens it up in adobe and not in a browser so you have no control over it. If you add an alert after the open statement,you will see that the browser says it is closed.



That means we loose control over this window. Only option you have in this case would be to change the second parameter in window.open to have a unique name.

Eric
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear Sir,
I did everything accoding to your advise.But still this error happening.

Dear All,
If any body knows the solution for my problem please guide me for the needful.


Thanks a lot in advance.

Regards
Sumanta
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP page on closing the parent window the child windows should close automatically.
 
Similar Threads
issue with session on restart of server
Developing Web Application without IE toolbars
How to close all child windows from parent window
How to maintain session in Both Parent window and child window
submit form of child window and show the new screen in parent window.