防止使用后退按钮(在 IE 中) [英] Prevent Use of the Back Button (in IE)

查看:20
本文介绍了防止使用后退按钮(在 IE 中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我当前工作地点的中小企业想要尝试禁用某些页面的后退按钮.我们有一个页面,用户可以在其中进行一些选择并提交它们以供处理.在某些情况下,他们必须在另一个页面上输入评论.

So the SMEs at my current place of employment want to try and disable the back button for certain pages. We have a page where the user makes some selections and submits them to be processed. In some instances they have to enter a comment on another page.

用户发现,如果他们提交信息并转到带有评论的页面,然后点击后退按钮返回上一页,则他们不必输入评论.

What the users have figured out is that they don't have to enter a comment if they submit the information and go to the page with the comment and then hit the back button to return to the previous page.

我知道有几种不同的解决方案(其中许多比禁用后退按钮更优雅),但这就是我剩下的.是否可以通过改变后退按钮的行为来阻止某人返回上一页.(就像提交 - > 返回错误的东西).

I know there are several different solutions to this (and many of them are far more elegant then disabling the back button), but this is what I'm left with. Is it possible to prevent someone from going back to the previous page through altering the behavior of the back button. (like a submit -> return false sorta thing).

由于重复发布信息,我无法让它返回上一页然后移动到当前页面.我只能让它不直接离开当前页面.我用谷歌搜索了它,但我只看到帖子说它总是会回到上一页.我希望有人有一些 mad kung foo js 技能可以使这成为可能.

Due to double posting information I can't have it return to the previous page and then move to the current one. I can only have it not direct away from the current page. I Googled it, but I only saw posts saying that it will always return to the previous page. I was hoping that someone has some mad kung foo js skills that can make this possible.

我知道每个人都说这是一个坏主意,我同意,但有时你只需要按照你的要求去做.

I understand that everyone says this is a bad idea, and I agree, but sometimes you just have to do what you're told.

推荐答案

不要这样做,就是不要这样做.这是糟糕的界面设计,并迫使用户的浏览器以他们不期望的方式运行.

Don't do this, just don't. It's bad interface design and forces the user's browser to behave in a way that they don't expect.

我认为任何成功阻止我的后退按钮工作的脚本都是一种黑客行为,我希望 IE 团队为它发布一个安全修复程序.

I would regard any script that successfully stopped my back button from working to be a hack, and I would expect the IE team to release a security-fix for it.

后退按钮是他们程序界面的一部分,而不是您的网站.

The back button is part of their program interface, not your website.

在您的具体情况下,我认为最好的办法是在页面中添加一个卸载事件,如果用户尚未完成表单,则警告用户.后退按钮不会受到影响,并且用户会被警告他们的操作.

In your specific case I think the best bet is to add an unload event to the page that warns the user if they haven't completed the form. The back button would be unaffected and the user would be warned of their action.

这篇关于防止使用后退按钮(在 IE 中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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