It's hard to do this because some browsers will cache pages they open and so hitting the back button would actually load the page from the local cache rather than (re)obtain it from the server.
One idea I just thought of while typing this, is to use Ajax. Cached or not, the browser would have to re-execute the ajax code. Look into how to use ajax. When you grab the file, have the JavaScript append a random number in the query string so the browser won't cache the response.
Your handler for getting the data back from the CGI could simply document.write the page received.
This way, your "realdata.cgi" will be requested each time the user runs that JavaScript (either their first visit to the page or by clicking the back button), and the CGI could be programmed to log temporary data to see how many times the user has requested that CGI file.
A simpler solution is to open the quiz in a new window which doesn't have the toolbars, so the back button isn't there to click. People could still hit Backspace or Alt+Left to go back though, but it would make it harder for the average user who doesn't know these shortcuts.
They could also right-click and click "Back" but if you disable right-clicking, it solves that problem.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.