Solved

how to disable "go back" button

Posted on 2007-12-04
10
594 Views
Last Modified: 2012-05-05
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
Comment
Question by:andy7789
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 21

Accepted Solution

by:
nizsmo earned 150 total points
ID: 20409652
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
 

Author Comment

by:andy7789
ID: 20409671
but right click can be disabled by placing

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

works fine - ested 1000 times
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20409679
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
 
LVL 25

Expert Comment

by:imitchie
ID: 20409705
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
 
LVL 21

Expert Comment

by:nizsmo
ID: 20409731
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:andy7789
ID: 20409751
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
 
LVL 25

Assisted Solution

by:imitchie
imitchie earned 100 total points
ID: 20409786
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
 
LVL 36

Assisted Solution

by:Loganathan Natarajan
Loganathan Natarajan earned 150 total points
ID: 20409832
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 100 total points
ID: 20410004
0
 

Author Comment

by:andy7789
ID: 20410191
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

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now