• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 640
  • Last Modified:

how to disable "go back" button

Hi,

I quick question - how to disable Go Back on the page (either clicking on the browser's button or via the context menu)?

Thank you,

A
0
andy7789
Asked:
andy7789
  • 3
  • 3
  • 2
  • +2
4 Solutions
 
nizsmoDeveloperCommented:
Three methods described here:
http://www.htmlgoodies.com/tutorials/buttons/article.php/3478911

But it is not possible to disable the right click>>back function, and the methods are never going to be completely foolproof.
0
 
andy7789Author Commented:
but right click can be disabled by placing

<body onLoad="oncontextmenu="return false">

works fine - ested 1000 times
0
 
nizsmoDeveloperCommented:
hmm, i guess you can do that with the combination of one of the methods above, which would catch 95% of the users.

Why i say 95%, because 95% of the users have javascript enabled, for the 5% of the users, these methods will not work at all as javascript will not even get a chance to run.

Hope this helps :)
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
imitchieCommented:
Firefox + Noscript is very very common..... and Firefox is up to 25% usage now (statistics always lie, if you don't like this one, I can show you another!)
0
 
nizsmoDeveloperCommented:
indeed, noscript was what i had in mind (as i use it myself). Still though, majority of the users do have javascript enabled, so for most of the users it would work, but certainly not all.
0
 
andy7789Author Commented:
that code is not exactly what i am looking for. I am opening a modal window with ajax and, while all clicks on the page except the modal window are disabled, the back button makes a big mess. Jscript is absolutely fine as the whole site is not functional without jscript.

What I need is to make sure that clicking on the back button would stay on the same page

Any other solutions
0
 
imitchieCommented:
The only way so far is still
  history.go(+1)
A lot of sites you that and is very annoying. A smart(er) user will dropdown the history and go back 2 steps, but your 80% joe average will not do that. nor will they use right-click...
0
 
Michel PlungjanIT ExpertCommented:
0
 
andy7789Author Commented:
thank you guys, I guess my question goes to a different angle: how to disable page caching for certain pages, because it is the main reason for a mess when clicking the back button. I am posting another question and splitting the points for this one.
0
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now