This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes detect closing IE browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "detect closing IE browser" Watch "detect closing IE browser" New topic

detect closing IE browser

gino jersey

Joined: May 24, 2005
Posts: 21
Our app uses struts, and it uses the onunload event:

The code catches users when they click on "Home" in Internet Explorer. A pop up dialog shows , and they are asked if they really want to exit or return to the application.

It was also the case when a users tries to close the browser by clicking the X in the upper right hand corner, the pop up dialog comes up to confirm.

The problem now is that when the user clicks the small X to close the browser the main browser just closes, the dialog pops up (which is by now useless because there is no application to return to). This was working til a feww days ago and suddenly it is not.

We are investiagting if there is anyting in IE settings that could affect this behavior.

Another option we are looking at is the onbeforeunload event.
Seems to work when I put it in one of the pages.
However, when I try to go to the next page within the application (as defined by struts) it also triggers the onbeforeunload event, which we don't want.

Does anyone know how I can get this event to work properly and still keep the flow defined by struts.

I agree. Here's the link:
subject: detect closing IE browser
It's not a secret anymore!