Silverlight modal dialog interferes with browser's onbeforeunload dialog
I'm in a Silverlight 4.0 project where we have a variety of windows and dialogs, some of which are modal. In the hosting HTML, we've bound the onbeforeunload event so that we can warn users before their browser forces them to lose any changes from the Silverlight app (by accidentally hitting F5, for example).
However, if there happens to be a modal showing in the Silverlight app, the browser's onbeforeunload dialog is hidden from view, and the user can't click anything. The only recourse it to kill the browser process. We've observed this both in IE8 and IE8 so far.
Has anyone else encountered this? 开发者_运维技巧If so, what workarounds have you used?
Just a thought, but what if you included a method within your Silverlight application to close all modal dialogs that you could call via JavaScript?
Take a look at this link for additional information:
http://blogs.silverlight.net/blogs/msnow/archive/2008/07/08/tip-of-the-day-15-communicating-between-javascript-amp-silverlight.aspx
So you could create a method to close all modals within Silverlight, and when your onbeforeunloaded event is called, you can include a call into this Silverlight method to close the modals.
精彩评论