gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 00:39:12 24 4
gpt4 key购买 nike

我正在开发 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:如何禁用浏览器的刷新按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4673715/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com