• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Disabling refresh

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have developed an online exam system. when a user clicks on the "Start Test" button, the timer starts at the top of the page and questions are generated.

Now if the users refreshes the page, timer starts again and new set of questions come up (since of i have used random generation logic) .

i want users not to be able to refresh this page (disable refresh) so that timer should countdown till the end and for questions only one set of questions for one user be generated.

Any suggestions for this problem would be helpful.

Thanks in advance.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You cannot successfully disable refresh in a cross-browser manner. And you shouldn't. See InterfaceDesignersRule1.

What you should do is to track the state of the exam and the timer in the session (most likely employing Ajax to send the state to the server periodically). That way, when the user refreshes, you can detect that they were in the middle of an exam, and restore the state at the time of the refresh.
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic