Disable back button

On all or any of the browsers, is there a way to completely DISABLE the back button for the browser


Intercept the attempt and do something else (as in...do nothing)  ??

If not via ASP.NET or javascript....are there 3rd party controls or software that do this?  What about browser plugins?
Tom KnowltonWeb developerAsked:
Who is Participating?
jppintoConnect With a Mentor Commented:
You can't change the behavior of the browser but you can try this:


BuggyCoderConnect With a Mentor Commented:
well all you need to do is disable history or clear it at each page access....

<SCRIPT LANGUAGE=javascript>

  var Backlen=history.length;   history.go(-Backlen);
  window.location.href=page url


The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

_agx_Connect With a Mentor Commented:
(no points ...)

AFAIK there's no 100% bullet-proof way to do that.  It begs the question is why do you want to disable it? Often the reason is something that could be better handled another way.
Tom KnowltonWeb developerAuthor Commented:
I cannot speak to the "why" at this point.

I was just asked to research "can you do it" and "how"

I realize it is anti-social and uncooth.

I think it is just one particular page we want to make it difficult for them, where going back would have some fairly serious consequences (for their transaction, for example).
dxdinhConnect With a Mentor Commented:

 I came across a cool jquery plug in and back space - you can disable it totally. Checkout jquery bbq plugin from Ben Alman


 you can try the demo - try to backspace on his demos - such a cool plugin


Yeah, I understand.  Usually when the question comes up it's because something non-trivial is involved. That is why I said there's no 100% sure way to do it.  Not in a standard html page.  

>> I think it is just one particular page we want to make it difficult for them, where going
>> back would have some fairly serious consequences (for their transaction, for example).

I don't know the structure of your pages. But its sounds like you're talking about a page processes a transaction. So you want to prevent users from reloading it (ie paying 2x). Usually a better way to handle that is with redirects: either server or client side. Server side redirects don't show up in the client browser at all and with the correct headers, client side redirects would not either.

Btw: When I say server vs client redirect I'm not talking about javascript

The link in jppinto's post briefly touches on redirects.  IMO it's better than depending on javascript (which can be disabled).  But IIRC, all methods (except server side transfers) can be circumvented.  

If as you say, you're only trying to make it more difficult, those methods might suffice. But bottom line: if something catastrophic will happen if technique xyz fails, then .. expect it to happen and handle it in code.  Because those darned "users" always seem to find ways to make the "impossible" .. "possible" ;-)
Tom KnowltonWeb developerAuthor Commented:

WHERE is the demo, exactly?  ::: lost ::::
I think it's the 2nd link dxdinh posted.
mr_nadgerConnect With a Mentor Commented:
isn't there something in the accessibility ratings for websites which precludes turning the page back off? If so, you might want to check if your site requires a high rating
Kumaraswamy RConnect With a Mentor Commented:
in aspx page

<SCRIPT LANGUAGE=javascript>
Alpesh PatelConnect With a Mentor Assistant ConsultantCommented:
You cannot disable the button but override the back action using removing the history. by loading the same page on click of back button of explorer.
Tom KnowltonWeb developerAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.