Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to disable the Back and Forward navigation buttons

Status
Not open for further replies.

rambleon

Programmer
Mar 6, 2004
130
IL
I would like to have control over which forms the user goes to from within my application. Can I disable the back and forward buttons?
 
In my opinion It's not really a good idea to control the way users navigate through the browser. Unless you really need to do this here are a couple of things you can do..

put this in your Global.asax file. But this will expire all pages after a request is made to say a DB.

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1)
Response.AddHeader("pragma", "no-cache")
Response.AddHeader("cache-control", "private")
Response.CacheControl = "no-cache"
End Sub

this will stop users from going back and forth.


The other option would be to simply use the window.open method and say toolbar=no and menubar=no

again, you may want to think about this before trying to control the way users browse. I only disable the toolbar etc when opening up something like a printable version of a page.

I'm sure you will get more examples from the pros on this.

 
You kill the back button with JavaScript on preceding page:
<script language="JavaScript">
<!--
javascript:window.history.forward(1);
//-->
</script>
 
If anyone messed with my browser setting like not allowing me to go forward and backwards I wouldn't be very happy and would probably leave your site. It should be up to me where I want to go and how to use my browser, and it should be up to the website developer to cope with this.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Sorry I should have been more clear.
Hitting the back button returns me to the login page which contains the previous login info, which I want to avoid.
 
But you still shouldn't disable the option that allows me to go back a page (even if it is to your login page). If you want to remove the contents of certain controls when I do go back, then fair enough, but don't stop me using my browser as I want to!


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I agree it's not very user freindly, but how can I ensure that the login page does not contain the previous persons login info.
 
By using the method of using a session flag that I pointed out to you in thread855-1144127.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top