注销后如何禁用浏览器后退按钮

注销后如何禁用浏览器后退按钮

本文介绍了注销后如何禁用浏览器后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在使用链接按钮注销选项.该页面将重定向到登录页面.在此浏览器之后,后退和前进按钮要禁用.不想再次显示登录页面.

"Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);"

我尝试了这段代码.但它不起作用.你能帮我吗?

谢谢
问候,
Sangeetha

Hello,

I am using link button for log out option. The page will redirect to login page. After this browser back and forward buttons want to disable. Don''t want to display the logged in page again.

"Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);"

I tried this code. But its not work. Can you please help me?

Thank you,
Regards,
Sangeetha

推荐答案

Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
        Response.AddHeader("pragma", "no-cache");
        Response.AddHeader("Cache-Control", "no-cache");
        Response.CacheControl = "no-cache";
        Response.Expires = -1;
        Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
        Response.Cache.SetNoStore();

         Page.ClientScript.RegisterStartupScript(this.GetType(), "cle", "windows.history.clear", true);


Or Use this JavaScript


Or Use this JavaScript

<script>
function noBack(){window.history.forward();}
noBack();
window.onload=noBack;
window.onpageshow=function(evt){if(evt.persisted)noBack();}
window.onunload=function(){void(0);}
</script>


查看更多信息



History.Forward()

.


这篇关于注销后如何禁用浏览器后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 06:32