You can't disable the Back button in a web browser. Workarounds use JavaScript, but JavaScript can be turned off on a clients browser. Also, Alt + <- (back arrow) has the same effect as a browsers Back button.
Workarounds use JavaScript, but JavaScript can be turned off on a clients browser.
To repeat what I stated in my first post: JavaScript can be turned off in a clients browser. Your solution involves JavaScript. Therefore, there's a 50/50 chance that it might work. All it does is send a person forward when
they go backwords. That is very annoying and one of those bad design concepts that should be avoided.
Moved to here by moderator XIII: The FAQ forum is the best way to provide answers to common questions.
Hi, after a very large research on the topic "back button problem" along all the Web, I've found the answer and it works only for itself, without need to write anything else such as code lines or meta data on the head of the page.
Simply put this javascript between your <head></head tags, and you're done:
I know there are times when a workaround solution like this becomes necessary, but I have to STRONGLY suggest working WITH the browsers built in functions, rather than against them. It may work for your application, to disable the back button, but there
is a USER running your application, and in virtually EVERYTHING else that user does on the internet, they are going to recognize the back button as a method of navigation...when you remove that due to a limitation in your application, you are going to end
up with confused, and possibly miffed users.
One of the best pieces of advice I ever got was...software developers suck at running software - Keep your users in mind.
I totally agree with you, the thing is that my web app really needs to "lock" this button. Is not ano option, but yes a requirement of the aplication. As for me, there are other ways to prevent a few things that the user can do with this bac button, but as
the requirements are to work, here it is!
The only problem is if the browser does not support javascript, but as I say, better something than nothing!
The issue that "it does not work if JavaScript is turned off" is, IMHO, a major problem.
Even setting aside the argument (stated above) that it is not nice to reach behind the user's back, (which is a good argument)-- the fact that the solution does not work without JavaScript is a show-stopper.
As such, the code is a stop-gap and best-effort "feature" at best-- not a reliable solution.
(Tightly tracking workflow might be better. Maybe. But, that's a lot of work to do it right.)
Javascript is for convinience and better user interface. Your application can never reply on it for correctness. Ultimately what's going down the pipeline are those key=value pairs, and that's the only thing your server recognizes and responses to.
Tightly tracking workflow might be better. Maybe. But, that's a lot of work to do it right
What does that mean?I did not understand!!!...
What I mean by that is that if the application needs to be very concerned about the navigation paths, then the application could specify those "allowed paths" explicitly. All other paths would be automatically considered "disallowed paths" and would be handled
by the application accordingly such as redirecting to a default page. And so on.
For example, for a simple linear wizard workflow, the application might configure something like the the following...
The Microsoft User Interface Application Block does something like this.
Anyway, that's what I was talking about.
As might be obvious, such an implementation would take a bit of work, especially if it had to be generic (which it should be)-- but, it could be done and probably would be nice to have.
StrongTypes
All-Star
30801 Points
6013 Posts
ASPInsiders
How do I disable the Back button in a web browser?
May 10, 2006 02:07 PM|LINK
You can't disable the Back button in a web browser. Workarounds use JavaScript, but JavaScript can be turned off on a clients browser. Also, Alt + <- (back arrow) has the same effect as a browsers Back button.
See A Thorough Examination of 'Disabling the Back Button'.
BilalShouman
Member
40 Points
1 Post
RE:Disable Back in your web Browser
May 11, 2006 12:17 AM|LINK
Add this script:
<script>history.go(1)</script>
This way you can't go page to this page.
StrongTypes
All-Star
30801 Points
6013 Posts
ASPInsiders
Re: RE:Disable Back in your web Browser
May 11, 2006 03:54 PM|LINK
<script>history.go(1)</script>
This way you can't go page to this page.
To repeat what I stated in my first post: JavaScript can be turned off in a clients browser. Your solution involves JavaScript. Therefore, there's a 50/50 chance that it might work. All it does is send a person forward when they go backwords. That is very annoying and one of those bad design concepts that should be avoided.
dvd.ribeiro
Member
395 Points
262 Posts
Disable the use of back button on browser - the solution
Jan 30, 2007 01:17 PM|LINK
Moved to here by moderator XIII: The FAQ forum is the best way to provide answers to common questions.
Hi, after a very large research on the topic "back button problem" along all the Web, I've found the answer and it works only for itself, without need to write anything else such as code lines or meta data on the head of the page.
Simply put this javascript between your <head></head tags, and you're done:
<script type="text/javascript" language="javascript">
javascript:window.history.forward(1);
</script>
The only problem is if the browser does not support javascript, but as I say, better something than nothing!
David Ribeiro
Freakyuno
Star
12518 Points
1952 Posts
Re: Disable the use of back button on browser - the solution
Jan 30, 2007 01:34 PM|LINK
I know there are times when a workaround solution like this becomes necessary, but I have to STRONGLY suggest working WITH the browsers built in functions, rather than against them. It may work for your application, to disable the back button, but there is a USER running your application, and in virtually EVERYTHING else that user does on the internet, they are going to recognize the back button as a method of navigation...when you remove that due to a limitation in your application, you are going to end up with confused, and possibly miffed users.
One of the best pieces of advice I ever got was...software developers suck at running software - Keep your users in mind.
My Blog
dvd.ribeiro
Member
395 Points
262 Posts
Re: Disable the use of back button on browser - the solution
Jan 30, 2007 02:35 PM|LINK
David Ribeiro
mkamoski
Contributor
5694 Points
1565 Posts
Re: Disable the use of back button on browser - the solution
Jan 31, 2007 01:49 AM|LINK
The issue that "it does not work if JavaScript is turned off" is, IMHO, a major problem.
Even setting aside the argument (stated above) that it is not nice to reach behind the user's back, (which is a good argument)-- the fact that the solution does not work without JavaScript is a show-stopper.
As such, the code is a stop-gap and best-effort "feature" at best-- not a reliable solution.
(Tightly tracking workflow might be better. Maybe. But, that's a lot of work to do it right.)
That's just my opinion.
Thank you.
-- Mark Kamoski
dvd.ribeiro
Member
395 Points
262 Posts
Re: Disable the use of back button on browser - the solution
Jan 31, 2007 11:32 AM|LINK
Tightly tracking workflow might be better. Maybe. But, that's a lot of work to do it right
What does that mean?I did not understand!!!Anyway, thanks for your opinion, everything and everyone is welcome!
David Ribeiro
haoest
Participant
1768 Points
404 Posts
Re: Disable the use of back button on browser - the solution
Jan 31, 2007 03:39 PM|LINK
mkamoski
Contributor
5694 Points
1565 Posts
Re: Disable the use of back button on browser - the solution
Jan 31, 2007 06:39 PM|LINK
What I mean by that is that if the application needs to be very concerned about the navigation paths, then the application could specify those "allowed paths" explicitly. All other paths would be automatically considered "disallowed paths" and would be handled by the application accordingly such as redirecting to a default page. And so on.
For example, for a simple linear wizard workflow, the application might configure something like the the following...
Form="HomeForm" AllowedFormListForPrevious="All" AllowedFormListForNext="StartForm"
Form="StartForm" AllowedFormListForPrevious="HomeForm" AllowedFormListForNext="Step1Form,HomeForm"
Form="Step1Form" AllowedFormListForPrevious="StartForm" AllowedFormListForNext="Step2Form,HomeForm"
Form="Step2Form" AllowedFormListForPrevious="Step1Form" AllowedFormListForNext="FinishForm,HomeForm"
Form="FinishForm" AllowedFormListForPrevious="Step2Form" AllowedFormListForNext="HomeForm"
...and so on...
The Microsoft User Interface Application Block does something like this.
Anyway, that's what I was talking about.
As might be obvious, such an implementation would take a bit of work, especially if it had to be generic (which it should be)-- but, it could be done and probably would be nice to have.
HTH.
Thank you.
-- Mark Kamoski