Disable client browser's Back/Forward button?

T

Terry Olsen

Is there any way to disable the client browser "Back" and "Forward"
buttons while on my site? Or how would I go about knowing that a page
hit is caused by a back/forward navigation?

I have discovered that my web app is definately NOT Back/Forward safe.
It's really messing with my SQL data bigtime.

Thanks.
 
S

Steve C. Orr [MVP, MCSD]

There is no good way to disable the buttons.
If you pop open a new browser window you can hide the buttons but the user
can still navigate with the keyboard.
If you pop open a new browser windows then the back button will be disabled
because that window has no history.

A better approach is to disable caching so a the page must be requested
fresh each time.
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")
 
Joined
Aug 22, 2008
Messages
1
Reaction score
0
Disabling browser back/forward buttons

Hi,

Can you plz let me know what's this "Pragma" means?
I have the same question how to disable back/forward button of browser when i click "logout" button in my applictaion.
only when i click logout this should happen not in any another cases.

Thank you.
Raam
 
Joined
May 8, 2009
Messages
1
Reaction score
0
Raam said:
Hi,

Can you plz let me know what's this "Pragma" means?
I have the same question how to disable back/forward button of browser when i click "logout" button in my applictaion.
only when i click logout this should happen not in any another cases.

Thank you.
Raam

"Pragma" is the cookies name is guess which you use.
Code below works for me to clear and disable the cookies / cache which i place in page load. So everytime user click back to main page it will clear off the cookies. hope this will help.

Response.Expires = 0
Response.Cache.SetNoStore()
Response.Cookies.Remove("LoginID")
Request.Cookies.Remove("LoginID")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top