Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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.
 
Sheriff
Posts: 26957
84
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: 67619
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....


 
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic