您可以通过javascript检测/重定向后退按钮按下吗? [英] Can you detect/redirect a back button press through javascript?

查看:43
本文介绍了您可以通过javascript检测/重定向后退按钮按下吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户单击后退"按钮,我试图检测并更改浏览器的行为.

I'm trying to detect and change browser behavior if a user clicks on the back button.

这甚至可以通过Javascript实现吗?

Is this even possible through Javascript?

推荐答案

哇,我刚刚阅读了有关javascript的教程,学到了很多东西.它讨论以下内容:

Wow i just learnt a lot by reading this tutorial on javascript. It talks about the following things:

使用Java掌握后退按钮

  • window.onbeforeunload
  • 您真的确定要离开我光荣的页面吗?
  • 检测用户单击取消的时间
  • 真正的动态页面
  • 一些安全注意事项.
  • 您不能更改历史记录,最后
  • 如果您必须控制历史记录

讨论锁定状态下的历史记录.您可以进行有限的更改.但是您可以放置​​一个替换URL,这样如果有人决定返回该URL,它将重定向到另一个页面.出于安全原因,如果一个人登录然后注销,然后另一个人按下后退"按钮,则该页面将被带到替换页面.

which talks about how history have been made with lock down. You can make limited changes. But you can put a replacement URL so if a person does decided to go back it will redirect it to a different page. It will be good for security reasons, if a person logs in then logs out, and another person presses the back button, the page will just be taken to the replacement page.

签出它确实简短,准确,内容翔实,并且包含许多Java代码段,可帮助您在每一部分中获得帮助.

check it out Its really short and precise, informative article/tutorial and contains many java snippets to help you for each section.

http://www.hunlock.com/blogs/Mastering_The_Back_Button_With_Javascript

我希望这会有所帮助.

PK

这篇关于您可以通过javascript检测/重定向后退按钮按下吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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