Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

BACK

Posted on 2003-02-23
10
Medium Priority
?
173 Views
Last Modified: 2010-04-09
How can I prevent someone from using the BACK button to go back to the previous page they were on?  I have a quiz on my site and want to prevent someone who gets the answer wrong from going BACK and taking another guess at the same question.  Is there something I can add to a meta tag to prevent them from being able to use the back button on their web browser?
0
Comment
Question by:gcassel
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 1

Expert Comment

by:Jonza
ID: 8006425
No, you cant prevent users from using the BACK -button...
0
 
LVL 1

Expert Comment

by:Jonza
ID: 8006430
But for your purpose it would be possible to store allready answer to a session or cookie variable and allways when user answers a question some script would check if that variable allready exists (user is cheating).

Can you use PHP on your server?
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8006482
The other option is to launch the quiz in a new window, and turn off the toolbars. Then they can't press the back button, because there won't be one visible for the window.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Expert Comment

by:Jonza
ID: 8006497
kasandra that doesn't work perfectly.
yea, you can turn off the toolbars but not for all browsers. some browser just don't allow it. and you still can use keyboard shortcuts to go back.
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8006550
But how many people know the keyboard shortcuts?

It is a very straightforward approach to try, without requiring any PHP etc, just javascript to launch the window.
0
 
LVL 1

Expert Comment

by:Jonza
ID: 8006567
the people that usually knows that you could cheat bu going back knows the KB-shortcuts.. hey it isn't that difficult just press backspace...

still recommend the cookie thing =)
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8006627
Just offering an alternative to try...

Since the answer to "can I disable the back button?" is no, as Jonza correctly pointed out, we're now offering "workarounds" rather than solutions. There is no solution.

One particular workaround is not necessarily going to be the one true answer, so all we can do is offer different suggestions to see if one in particular (or a combination) appeals to gcassel.
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 200 total points
ID: 8012425
You can place this code:

<script language=JavaScript>
<!--
   history.forward()
//-->
</script>

at the top of all your pages that you do not want them to go back to.
history.forward() will push the browser to the next page in the
history. So, if it's on every page, it will always bring them all
the way back to the page they were on.  It won't bounce them when they
come to a page initially because there is no next page.

Cd&
0
 

Author Comment

by:gcassel
ID: 8013889
I want to thank kassandra and jonza for their comments.  I actually did code the pages with a session variable to check for users trying to go back and redo the same question.  I discovered that without this check a user could easily run up their score by continually hitting the back button and doing the same question over and over again.  The seesion variable seems to work but I have had some users who have remarkably been able to score very high within a short period of time.  I therefore was looking for another method to make sure they could not go back and work around my code.  The one suggested by COBOLdinosaur fills the bill.  Thanks.  It is nice to see that old reptiles can learn new tricks.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8017353
Actually it is an old trick.  Not useful for most situations, because it can really irritate users when you mess with navigation.  However this is the sort of application where a little dirty trick prevents the cheat; so the only complaint they could make would be that they can't cheat anymore. ;^)

Glad we could help.  Thanks for the A. :^)

Cd&
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question