469,623 Members | 1,683 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

How To disable BACK BUTTON?

disable back button..... page should no do postback...
i used history.go, history.back, session.abandon...and many more...but still previous page shows.... help me to expire the previous page.......
Feb 9 '08 #1
3 2679
acoder
16,027 Expert Mod 8TB
This has been asked a number of times. See, for example, this and this.
Feb 9 '08 #2
this is the code to disable back button
just try this

<script language="javascript">
javascript:window.history.forward(1);
</script>
Feb 29 '08 #3
acoder
16,027 Expert Mod 8TB
<script language="javascript">
javascript:window.history.forward(1);
</script>
There are a number of problems with this.

Firstly, language is deprecated - use type="text/javascript" instead.

Secondly, there's no need for the javascript: protocol here.

Thirdly, and most importantly, there's no reliable way to disable the back button. One way is to use location.replace, but it can't be 100% reliable. If this is needed for a web application, just warn the user instead.
Feb 29 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by nntp | last post: by
14 posts views Thread by Sinity | last post: by
6 posts views Thread by Raghu Raman | last post: by
3 posts views Thread by Paul | last post: by
1 post views Thread by Terry Olsen | last post: by
16 posts views Thread by Barry Gilmore | last post: by
9 posts views Thread by Joe Delphi | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.