Solved

how to disable "go back" button

Posted on 2007-12-04
10
612 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
[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
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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
 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…
Suggested Courses

635 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