?
Solved

BACK

Posted on 2003-02-23
10
Medium Priority
?
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Suggested Courses

777 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