• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cancelling Window onclose event.

 
Ranch Hand
Posts: 59
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28138
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67745
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....


 
reply
    Bookmark Topic Watch Topic
  • New Topic