禁用浏览器的后退按钮 [英] disable back button of browser

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

问题描述

从用户退出Web应用程序后,如何限制用户访问任何安全页面?如何禁用浏览器的后退按钮,以使用户注销后无法通过单击后退按钮进入上一页?
我已经尝试过javascript''window.history.forward(0),它在Firefox中有效,但在歌剧中无效!如何清除浏览器的缓存/历史记录?在所有浏览器中都可以使用的任何其他方法?请告诉我...

How can i restrict user from accessing any secure page after he/she logged out from the web application? How the back button of the browser can be made disable so that after user logged out he/she can''t enter the previous page by clicking back button?
i have tried javascript ''window.history.forward(0), it works in firefox but not in opera!! How can i clear the cache/history of the browser?? Any other method which can work in all browsers?? Please tell me...

推荐答案

这是错误的方法. APS.NET应用程序无权访问浏览器,并且不应尝试使用它.如果某些使用客户端脚本的浏览器可能这样做,则某些其他浏览器不必遵循此规则.

而是,网站状态模型应容忍任何用户的导航.在更坏的情况下,页面被认为处于无效状态,因此页面上的某些控件被禁用.与浏览器本身的控件不同,Web应用程序从不触摸它们,也不承担任何有关它们的内容.这是体面的基于身份验证的网站的工作方式.

—SA
This is a wrong approach. APS.NET application does not have access to a Browser and should not attempt it. If this is possible for some Browser using a client-side script, some other Browser does not have to follow this rule.

Rather, the Web site status model should be tolerant to any user''s navigation. In worse case, the page is considered in the invalid state, so some controls on the page are disabled. Not so about the controls of the Browser itself — the Web application never touchs them and never assumes anything about them. This is how decent authentication-based sites work.

—SA


第二个SAKryukov.

有关您的信息,请参阅此提示/技巧.

注销后浏览器后退按钮问题 [
I second SAKryukov.

For your information, look at this Tip/Trick.

Browser back button issue after logout[^]


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

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