Silverlight: how to disable browser refresh button?

I am working on a Silverlight application (i.e. without HTML content), and one of the biggest complaints is that if a user accidentally lands on F5, the application restarts.

So is it possible to disable the Refresh button in the browser? Or at least handle F5?

+4
source share
1 answer

Here are some options.

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

From the link:

One option is to connect the "onbeforeunload" object to the window and ask the user to confirm refresh / exit. Here is a simple example that you can define in your HTML markup or even release from an SL application (if it has DOM access):

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

Source: https://habr.com/ru/post/1335303/


All Articles