views:

34

answers:

1

Based on http://mark.mymonster.nl/2009/02/28/integration-of-browsers-unloading-with-silverlight/ I know when the user closes a browser window containing Silverlight, by use of javascript. This basically creates a popup window, where the user can stay on the page(by clicking CANCEL), or exit the page (by clicking OK).

I am interested in how I can determine if the user wants to exit the page, or continue to stay on the page.

+1  A: 

You can determine that the user wants to exit the page because the Application_Exit will run and/or you can hook the browser onunload event in the same way you have the onbeforeunload.

The only way to determine that user doesn't want to exit is to wait and see if the Application_Exit isn't entered or the browser's onunload event isn't fired.

Why would you want to know that "the user considered leaving but then thought better of it" anyway? On cancel nothing should have changed, its a non-event.

AnthonyWJones