aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Cancelling Window onclose event. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Cancelling Window onclose event." Watch "Cancelling Window onclose event." New topic
Author

Cancelling Window onclose event.

Ravi Majety
Ranch Hand

Joined: Feb 26, 2009
Posts: 59

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
Bartender

Joined: Oct 14, 2005
Posts: 18657
    
    8

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

Joined: Jan 10, 2002
Posts: 61424
    
  67

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ravi Majety
Ranch Hand

Joined: Feb 26, 2009
Posts: 59


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....


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cancelling Window onclose event.