浏览器后退按钮的痛 [英] pain of browser back button

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

问题描述

有没有使用JavaScript(或别的东西)来检测/ prevent用户点击浏览器的后退/前进按钮什么办法?

Is there any way using JavaScript(or something else) to detect/prevent that user clicked on browser back/forward button ?

我想了解一下常见的做法来处理这​​个问题。这真是特别是在样订货工作流程的痛苦。

I would like to know about the common practice to deal with this issue. This is really pain especially in the work flow like ordering.

推荐答案

其实$ P $使用后退或前进按钮pventing用户是坏的可用性和会让用户感到失望了很多 - 说白了,它通过开发问题回给用户。

Actually preventing the user from using the back or forward button is bad usability and will frustrate users a lot - to be blunt, it's passing a developer problem back to the user.

我觉得邮政/重定向/获取模式,加上窗口.onbeforeunload 在JavaScript(像这样使用)将是您的情况真的很有用。

I think the Post/Redirect/Get pattern, coupled with window.onbeforeunload in javascript (like SO uses) would be really useful for your circumstances.

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

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