Silverlight 4的:检测浏览器F5 /刷新和X /关闭 [英] Silverlight 4: Detect browser F5 / refresh and X / Close

查看:124
本文介绍了Silverlight 4的:检测浏览器F5 /刷新和X /关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

欲确定如何过滤F5中,通过Silverlight的4.0或甚至在服务器端刷新按钮,X和关闭在浏览器

I want to determine how to filter F5, refresh button, X and close in browser via silverlight 4.0 or even in server side.

感谢您

编辑:

我添加赏金我的问题就在今天,7月28日2011年我的previous解决方案/回答不再在IE 9的工作。

window.onunload = function (e) {
    // Firefox || IE
    e = e || window.event;
    var y = e.pageY || e.clientY;

    if (y < 0) {
        alert("close");
    }
    else {
        alert("refresh");
    }
}

当用户按下F5键,刷新,X和关闭按钮,消息框应该不会出现。万一该解决方案onbeforeunload。

When the user hit F5, refresh, X and close button, message box should NOT appear. Just in case the solution is onbeforeunload.

感谢您的帮助!

推荐答案

,因为它是不可能在客户端,我做到了在服务器端。

since it is not possible in client side, i did it in server side.

我解决这个使用code我的问题:

I solve my problem using this code:

window.onunload = function (e) {
        // Firefox || IE
        e = e || window.event;
        var y = e.pageY || e.clientY;

        if (y < 0) {
            alert("close");
        }
        else {
            alert("refresh");
        }
    }

这篇关于Silverlight 4的:检测浏览器F5 /刷新和X /关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆