This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Script Window Closing Issue - Immediate Help Required

A Smith
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic