This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Java Script Window Closing Issue - Immediate Help Required Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Java Script Window Closing Issue - Immediate Help Required" Watch "Java Script Window Closing Issue - Immediate Help Required" New topic
Author

Java Script Window Closing Issue - Immediate Help Required

A Smith
Greenhorn

Joined: Sep 03, 2004
Posts: 5
Hi,
I redirect to a page on which I've the following piece of code on a function as follows. Let me call this page "C". I call this function on the load of this page.


function fnClose()
{
window.parent.opener=window;
window.parent.close();
}




The reason why I'm setting like window.parent.opener=window is to avoid the warning message "The web page you are viewing is trying to close the window...". If I remove that line, then I get the above warning message.

Assume that I'm on a page called "A". From "A", I reach "B" by clicking a hyperlink.
And on "B" too,I've a hyperlink . On clicking this hyperlink, I reach a servlet that in turn redirects to "C" where I have the above piece of code to close my window.

This works very fine.

Now Assume that I've a second hyperlink in "A" itself. And I click to do something and come back to "A" once again. Now I reach "B" from "A" by clicking the first hyperlink. Now I click the hyperlink in "B" to reach "C". Now no JavaScript error is thrown, but window is not closed why?

In first case:
A--B--Servlet--C (At C, I close)-Close working fine

In second case:
A--A--B--Servlet--C (At C, I close)-What I get is a white page of C - the window is not closed. Why? I am puzzled. Could anyone provide me a quick solution?

Aravind
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
sounds like you have an issue of loosing reference between the windows.

Not sure exactly....

That is what you get for trying to close the window without the prompt! :roll:

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Script Window Closing Issue - Immediate Help Required
 
Similar Threads
accessing clicked hyperlink value of jsp page in servlet
parent window not refreshing second time
child window parent window different domain
session handaling in servlet
Facing problem on close of a popup which i opened using the action class.