Google Answers Logo
View Question
 
Q: Disable back button in internet explorer ( Answered 5 out of 5 stars,   7 Comments )
Question  
Subject: Disable back button in internet explorer
Category: Computers > Programming
Asked by: shaneskillen-ga
List Price: $100.00
Posted: 28 Sep 2005 19:50 PDT
Expires: 28 Oct 2005 19:50 PDT
Question ID: 574062
What is the code to disable the back button in internet explorer? Some
sites seem to trick it into thinking it's a refresh button. Survey
sites like intelliquest.com have done it successfully

Request for Question Clarification by sublime1-ga on 28 Sep 2005 22:54 PDT
shaneskillen...

It seems there are several ways to "disable the back button",
which is actually a misnomer, as the button remains present
and produces an effect, if not the one you'd like.

The code on intelliquest is rather convoluted, so I'm not
sure I've identified the specific code on their site which
produces the effect, but I think it has to do with this
section:

function selURL(dest) {

	goSection = dest.options[dest.selectedIndex].value;

	if (goSection) {

		top.location = goSection;

	}

Were you bent on finding the method used on the Intelliquest
site, or would a smorgasbord of other options satisfy you?

sublime1-ga
Answer  
Subject: Re: Disable back button in internet explorer
Answered By: leapinglizard-ga on 29 Sep 2005 12:03 PDT
Rated:5 out of 5 stars
 
Dear shaneskillen,


The trick is to use the history.forward() JavaScript directive in the
head section of each page. Thus, when the user attempts to back up within
your site, the script will bounce him forward each time.

This method should only be used to guide the user through a linear
interaction such as product purchase or survey completion, and not as a
gratuitous way of forcing the user to stay on your site. In any case, the
user can always leave by manually entering a new URL in the address bar.

I have prepared the following page for you as a simple demonstration.

Bounce Forward: Demonstration
http://plg.uwaterloo.ca/~mlaszlo/answers/bounceforward/index.html


The first time you visit this page, you will be able to use the back
button to return to the previous site you visited. This is correct and
desirable behavior. But as soon as you choose one of "foo!" and "bar!",
which represents the beginning of a linear user interaction such as a
purchase or survey, the back button is effectively disabled and you are
forced to use the links offered on each page to navigate within my site.

This effect is accomplished by including the following text in the <head>
portion of each page.

    <script>
        history.forward();
    </script>
    

Remember, users will welcome this feature only if you employ it as a 
navigational help rather than as a hindrance.

It has been a pleasure to address this question on your behalf.


Regards,

leapinglizard

Request for Answer Clarification by shaneskillen-ga on 09 Oct 2005 19:11 PDT
Awesome - I'm just having my techies look into it . . .but I'm pretty
sure you answered it!!! Will be in touch soon.

Clarification of Answer by leapinglizard-ga on 10 Oct 2005 21:52 PDT
I'm glad you are pleased with the answer.

leapinglizard
shaneskillen-ga rated this answer:5 out of 5 stars and gave an additional tip of: $10.00
Awesome - thanks!

Comments  
Subject: Re: Disable back button in internet explorer
From: spenlow-ga on 28 Sep 2005 21:04 PDT
 
Looks like it has something to do with Flash. If you go to this page,
you can see how it works:

http://intelliquest.com/corporate/left.html

Hope this helps.
Subject: Re: Disable back button in internet explorer
From: amglasgow-ga on 29 Sep 2005 18:48 PDT
 
I should note that a lot of usability experts feel that disabiling the
back button is an impairment to users' ability to effectively use your
website. See here: http://www.webdevtips.com/webdevtips/article.php?item=58
"Approximately 60% of Web users employ the back button as their
primary means of navigation." By analogy, disabling the back button
could be seen as an attempt to 'trap' users: "When you have visitors
over, it's only natural to hope they'll stay awhile. But most people
would consider it rude ? if not threatening ? if you locked the door
when they tried to go."
http://www.usatoday.com/tech/news/2001-05-29-mousetrapping.htm
Subject: Re: Disable back button in internet explorer
From: ogilvy-ga on 12 Oct 2005 08:18 PDT
 
Great job! I'm looking for you!
Subject: Re: Disable back button in internet explorer
From: leapinglizard-ga on 12 Oct 2005 09:34 PDT
 
Thank you for the rating and the kind tip.

leapinglizard
Subject: Re: Disable back button in internet explorer
From: simplevivek-ga on 24 Feb 2006 04:12 PST
 
Really a very neat and simple solution.
Subject: Re: Disable back button in internet explorer
From: jessehouston-ga on 14 Apr 2006 09:33 PDT
 
Cool, but a website should never be JavaScript dependent or any
scripting language dependent.
Subject: Re: Disable back button in internet explorer
From: veggie-ga on 17 Sep 2006 19:16 PDT
 
Fantsatic Solution !!

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy