使用jquery关闭刷新/重新加载/选项卡中的页面重定向 [英] Page redirect in refresh/reload/tab close using jquery

查看:66
本文介绍了使用jquery关闭刷新/重新加载/选项卡中的页面重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有mvc应用程序,我希望当用户重新加载/ f5 / tab关闭/浏览器关闭然后使用jquery我可以重定向到mvc操作。



< b>我尝试了什么:



我试过......

$(窗口).bind('beforeunload ',function(e){

window.location.href =/ Account / SessionEnd;

返回再见!;

});







$(窗口).unload(function(){

window.location.href =/ Account / SessionEnd;

返回再见!;

});







$(窗口).bind(function(){

window.location .href =/ Account / SessionEnd;

返回再见!;

});

解决方案

(window).bind('beforeunload',function(e){

window.location.href =/ Account / SessionEnd;

r eturn再见!;

});







(窗口).unload(function(){

window.location.href =/ Account / SessionEnd;

返回再见现在!;

});







(窗口).bind(function(){

window.location.href =/ Account / SessionEnd;

返回再见! ;

});


I have mvc application and i want that when user reload/f5/tab close/browser close then using jquery I can redirect to the mvc action.

What I have tried:

I have tried...
$(window).bind('beforeunload', function (e) {
window.location.href = "/Account/SessionEnd";
return "Bye now!";
});

OR

$(window).unload(function () {
window.location.href = "/Account/SessionEnd";
return "Bye now!";
});

OR

$(window).bind(function () {
window.location.href = "/Account/SessionEnd";
return "Bye now!";
});

解决方案

(window).bind('beforeunload', function (e) {
window.location.href = "/Account/SessionEnd";
return "Bye now!";
});

OR


(window).unload(function () {
window.location.href = "/Account/SessionEnd";
return "Bye now!";
});

OR


(window).bind(function () {
window.location.href = "/Account/SessionEnd";
return "Bye now!";
});


这篇关于使用jquery关闭刷新/重新加载/选项卡中的页面重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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