在浏览器中禁用转发 [英] Disable forward in browser

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

问题描述

嗨我有一个登录表单,当用户登录时应重定向到下一页。如果我关闭浏览器或选择注销或单击浏览器的后退按钮,则必须注销用户并再次显示登录页面。这很好用。但是,如果我单击浏览器的前进按钮而不提供任何用户名密码,浏览器将转到下一页。这不应该发生。怎么解决这个问题。请帮助我。

Hi I have a login form when user logged in it should redirect to next page. If i close the browser or select log off or browser''s back button is clicked the user must be logged off and again login page should be shown. This works fine. But if i click the browser''s forward button without giving any user name password the browser goes to next page. This should not happen. How to solve this. Pls help me.

推荐答案

在您登录的主页上试试这个

Try this on your logged in Home page
<script type="text/javascript">
if (window.history.forward(1) != null)
      window.history.forward(1);

if (window.history.backward(1) != null)
      window.history.backward(1);
</script>


您需要修复代码,以便它知道您的登录页面未被缓存。你不能阻止后退和前进按钮工作,你只需要编写有效的代码。
You need to fix your code, so that it knows your logged in pages are not cached. You can''t stop the back and forward buttons from working, you just need to write code that works.


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

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