开发者

How to determine if the user clicked OK or CANCEL when exiting Silverlight?

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 determ开发者_如何转开发ine if the user wants to exit the page, or continue to stay on the page.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜