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.
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 opinionated walrus
Marshal
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.