Customized message Box before Closing browser

Hi all,
Is it possible when a user close the browser to execute some code in order to make a choice before it.
In Chrome,closing the browser triggered a browser’s message saying

Leave Page
Changes you made may not be saved.

with 2 options. Is that possible before or after it to show another set of options related to thewebapp?

@Michael Batakis — Your browser is, most likely, in a window. If the end-user tries to close the window, you can do what you want in the CancelClose event ("are you sure? and alike) ; if you return true, closing the window will be cancelled.

You can use WebSession.ConfirmMessage but in most recent browsers the message itself is not displayed anymore. At least you should get a Cancel and OK button. Unfortunately you can’t really rely on this, as there are lots of ways to disconnect from a WebApplication w/o any chance to ask for a confirmation.

This is true, was trying confirmMessage but no luck. I think using cancel/ok button will be ok. I mean most users close the browser/browser tab when finish their work with my app. The other way is through session.timeout. Is there snything else?

Just a few that come in my mind:

  • Quit the browser
  • Crash the browser
  • Shutdown computer
  • Navigate using the Back/Fwd buttons
  • Enter a new URL
  • Open a Bookmark
  • Click an external Link
  • Close the Laptop lid
  • Walk out of WiFi
  • Rip out the network cable
  • Network/Internet issue
  • endless more…

And if you think you have handled all relevant cases: Use a different OS / browser / version and start from scratch :wink: With ConfirmMessage you can try to help the users but you can never protect them from themselves :wink:

Yes, i see… at least to hanle the most obvious cases. From my experience most users close the tab, close the browser or navigating back…
Thanks a lot!