Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cancelling Window onclose event.

 
Ravi Majety
Ranch Hand
Posts: 59
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I got an application where If the user tries to close the browser by clicking on the RedCross button , then the browser shouldn't get closed. So can anyone suggest me how to cancel that close event. I tried googling but i cant find any onclose event. The only event which captures is "onbeforeunload" and "onunload" events.

I assigned a function for onbeforeunload event , where i am returning the false but it is showing a dialog box with false as message with ok and cancel buttons.

Please suggest me the way to cancel the close event.


I want this as i want to call the logOff Process before closing the browser.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If such a thing existed then the malware writers would be using it to prevent you from closing their annoying pop-up windows. But they aren't. So I conclude it doesn't exist.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64822
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank goodness you are not able to annoy the population with such nonsense. Please read InterfaceDesignersRule1.
 
Ravi Majety
Ranch Hand
Posts: 59
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Thank goodness you are not able to annoy the population with such nonsense. Please read InterfaceDesignersRule1.

Hi Bear,

I know this question looks like nonsense as you said. But my requirement comes like that..we need to process logout request even when the user closes the window, because the useridentification is completely based on cookies and need to clear the cookies before closing the browser. Though the request is sent to server, the response is not captured by browser as it is been closed immediately .

So i thought of cancelling the close event and closing the browser after logoff process is completed which led me to post this request.

Finally we come out with an another approach which was processed successfully.

Thanks for sharing the DesignerRules....


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic