Silverlight:如何禁用浏览器的刷新按钮?

Silverlight:如何禁用浏览器的刷新按钮?,第1张

概述我正在开发一个Silverlight应用程序(即根本没有 HTML内容),最大的抱怨之一是,如果用户意外点击F5,应用程序将重新启动. 那么有什么办法可以在浏览器中禁用刷新按钮?或者至少处理F5? 这里有几个选项 http://forums.silverlight.net/forums/p/105879/243232.aspx 来自链接: One option is to hook into 我正在开发一个Silverlight应用程序(即根本没有 HTML内容),最大的抱怨之一是,如果用户意外点击F5,应用程序将重新启动.

那么有什么办法可以在浏览器中禁用“刷新”按钮?或者至少处理F5?

解决方法 这里有几个选项

http://forums.silverlight.net/forums/p/105879/243232.aspx

来自链接:

One option is to hook into the window
object ‘onbeforeunload’ event and
prompt the user to confirm the
refresh/exit intent. Here is a
simple example that Could be defined
in your HTML markup or even emitted
from the SL app (if it has DOM
access):

<script type="text/JavaScript">window.onbeforeunload = function() {    return "Leaving or refreshing this page can result in data loss.";}</script>
总结

以上是内存溢出为你收集整理的Silverlight:如何禁用浏览器的刷新按钮?全部内容,希望文章能够帮你解决Silverlight:如何禁用浏览器的刷新按钮?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1005323.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存