Silverlight 模式对话框干扰浏览器的 onbeforeunload 对话框
我在一个 Silverlight 4.0 项目中,其中有各种窗口和对话框,其中一些是模态的。在托管 HTML 中,我们绑定了 onbeforeunload 事件,以便我们可以在用户的浏览器强制用户丢失 Silverlight 应用程序中的任何更改(例如,意外按 F5)之前向用户发出警告。
但是,如果 Silverlight 应用程序中恰好显示模式,则浏览器的 onbeforeunload 对话框将从视图中隐藏,并且用户无法单击任何内容。唯一的办法就是杀死浏览器进程。到目前为止,我们已经在 IE8 和 IE8 中观察到了这一点。
还有其他人遇到过这种情况吗?如果是这样,您使用了哪些解决方法?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是一个想法,但是如果您在 Silverlight 应用程序中包含一个方法来关闭可以通过 JavaScript 调用的所有模式对话框,该怎么办?
请查看此链接以获取更多信息:
http://blogs.silverlight.net/blogs/msnow/archive/2008/07/08/tip-of-the-day-15-communicating- Between -javascript-amp-silverlight.aspx
因此,您可以创建一个方法来关闭 Silverlight 中的所有模式,并且当调用 onbeforeunloaded 事件时,您可以包含对此 Silverlight 方法的调用以关闭模式。
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.