限制用户在任何浏览器中刷新和返回 [英] Restrict user to refresh and back,forward in any browser
问题描述
我正在研究评估系统,其中候选人尝试参加考试。因此,呈现问题及其选择的页面是具有 iframe
的页面,其中问题是获取渲染。包含 iframe
的页面包含 JavaScript
计时器。
I am working on an evaluation system, In which candidate attempt for an exam. So the page where a question and its choices are get rendered is a page with iframe
, In that questions are get the render. The page which holds iframe
contains JavaScript
timer.
因此,当问题在浏览器上呈现以限制刷新时,我写了 F5
和 ctrl + F5
阻止代码,以便候选人可以不使用键盘快捷键刷新,但在浏览器窗口中,仍然可以使用刷新按钮或后退按钮。有没有办法禁用它?我知道玩浏览器功能并不是一种好习惯,所以有什么方法可以摆脱这种局面。
So when questions get render on the browser to restrict refresh I have written F5
and ctrl+F5
blocking code so candidate can't refresh using keyboard shortcuts but in a browser window, one can still use refresh button or back button. Is there any way to disable this? I know playing with browser functionality is not good practice, So is there any way to get out of this.
推荐答案
document.ready
我添加了这一行..
on document.ready
I added this line..
window.history.forward(-1)
这篇关于限制用户在任何浏览器中刷新和返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!