开发者

How can I disable F5 (refresh Browser) for Silverlight application without affecting closing?

I was reading this post and noticed that when I am closing browser or tab the message is showing as well. I need to disable the Refresh button or give some warning but problem with solution in that post is that it shows message when I close 开发者_开发技巧browser.

Is there any way to show message only on refresh?

I know that there are some posts like this on stackoverflow.com, but none of them work for me. So this is not a duplicate question unless there is a working solution.


window.onbeforeunload from JavaScript (as noted in the post you link to) really is the only way this can be done in a cross-browser, cross-platform way, that I know of.

But that does end up getting triggered for F5. That's just the way browsers work - they unload a page before reloading it, even in the refresh case.

Do you really find users hit F5 often enough for such a prompt to be a problem?


Isn't it possible to catch a key down event on F5? If not with silverlight you can probably with a keyboard hook.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜