禁用硬件后退功能jQuery Mobile [英] Disable hardware back function jquery mobile

查看:52
本文介绍了禁用硬件后退功能jQuery Mobile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在寻找一种方法来禁用后退按钮(Android上为硬件,iPhone上为软件),或将用户重定向到其他页面(然后是上一页).

So I'm looking for a way to either disable the back button (hardware on Android, software on iPhone), or redirect the user to a different page (then the one that was previous).

我这样做的原因不是出于邪恶目的或其他目的.我正在开发一款考试软件.用户回答考试/调查/测验中的所有问题,提交表单,然后转到页面以查看反馈.目前,如果他们按下硬件后退按钮,则会收到警告框,指出数据已经提交,但是仍然可以点击OK并返回考试并重新提交,因此重新提交相同的结果或更改他们的答案并重新提交,

My reasons for this aren't for nefarious purposes or anything. I'm working on a piece of exam software. A user answers all the questions in an exam/survey/quiz, submits the form, and is then taken to a page to see the feedback. At the moment, if they hit the hardware back button they get the alert box stating that the data has already been submitted, but they can still hit OK and be taken back to the exam and resubmit it, thus resubmitting either the same results or changing their answers and resubmitting,

我正在寻找一种禁用此功能的方法,可以通过某种方式禁用后退"按钮,也可以将用户重定向到新页面.

I am looking for a way to disable this ability, either by disabling the back button somehow, or by redirecting the user to a new page.

有关该应用程序的一些信息.不使用Ajax提交考试表格.整个应用程序是一个URL,无论您在哪个页面上,URL都始终相同.通过重新加载该URL,您将被带到登录页面(完全可以接受).

A little bit of info regarding the app. The exam form is being submitted not using Ajax. The entire app is one URL, no matter what page you are on, the URL is always the same. By reloading that URL, you are taken to the login page (this is perfectly acceptable).

我已经研究过HTML5历史记录功能,但是由于在较新版本的Android中缺乏支持,因此无法使用它.我需要可以在Android,iPhone以及WP7上正常运行的功能.

I've already looked into the HTML5 History capabilities, but because of it's lack of support in newer versions of Android, I can't use it. I need something that will work across Android, iPhone, and preferably WP7.

推荐答案

没有真正的方法来禁用Blackberry或Android上的硬件back按钮.

There is no real way disable the hardware back button on the Blackberry or Android.

您可以做的是维护一个会话变量,该变量将在您的back处理程序中失效,并在考试"页面的pagebeforeshow事件中检查该会话变量.

What you can do is maintain a session variable which gets invalidated in your back handler and check for that session variable in the pagebeforeshow event of the Exam page.

这篇关于禁用硬件后退功能jQuery Mobile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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