File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

Java Script Window Closing Issue - Immediate Help Required

A Smith

Joined: Sep 03, 2004
Posts: 5
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()

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?

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
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:

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Java Script Window Closing Issue - Immediate Help Required
jQuery in Action, 3rd edition