浏览器后退按钮和ajax [英] Browser back button and ajax

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

问题描述


我的网站有问题,如果我与用户登录然后退出并使用其他用户登录。

如果我按下浏览器后退按钮它将带我到第一个用户的页面,而不是我当前登录的用户。我正在使用ajax应用程序。是否有一个插件或我可以编写的代码告诉浏览器返回按钮模仿ajax调用?

Hi I have a problem with my website where if i sign in with a user then sign out and sign in with a different user.
if i press the browser back button it will take me to the page of the first user not the user i am currently logged in with.I am using an ajax application. Is there a plugin or some code i can write that will tell the browser back button to mimic an ajax call?

推荐答案

你可以使用

You can use
<script type="text/javascript">
       window.history.forward(1);
   </script>


主页面中的
或禁用后退按钮的正常页面。


in Master page or Normal page to disable back button.


在页面(头部)上使用以下代码,使用后退按钮阻止它们着陆。

Use the below code on the page(head) which you want to prevent to be landed using back button.
<script type="text/javascript">
  function preventBack() { window.history.forward(); }
  setTimeout("preventBack()", 0);
  window.onunload = function() { null };
</script>
 
<script language="JavaScript" type="text/javascript">
  javascript: window.history.forward(1);
</script>



问候:笑:


Regards :laugh:


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

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