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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Back button on browser help 1

Status
Not open for further replies.

jcisco

Programmer
Sep 17, 2002
125
US
Can someone help me solve this problem.. what i have going on is this.. on a form i have 2 textboxes, and one button. Now then when the user enters in a word in textbox1 and clicks on the button it puts that word into my multi lined textbox2, and clears textbox1. Then the user enters a second word and clicks the button this also adds the word. No problem here. BUT at anytime when the user clicks the back button on the browser it will take the word out of the multi box and place it back in textbox1... My questions is how do i prevent this from happing? One idea that i tryed was using the Ispostback in the pageload evt but when the back button is fired this evt is never called because it has already happened.. suggestions?

thanks

--------------
:)
 
Check out this article... it may help. I've used it to prevent users from going back to pages after they have been submitted.

-drew10
 
you can add

Response.CacheControl="no-cache";
Response.Expires= -1;

which will definitely prevent them from moving back...
 
faq855-3257

has alot of useful bits of information. But specifically, you can put:

<script language=javascript>
history.go(1);
</script>

on any pages where you do not wish for your users to go 'back'. There is no other way to fix your problem because technically, the situation you've described is exactly how it should act when a user presses 'back'.

The solution that wsmall73 has suggested will give the users a &quot;Warning - Page Expired&quot; message when they click back, whereas this solution will actually prevent them from moving back at all.

-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
sorry for the delay in the *, but it worked! Thanks!
One question though why do i have to put the
window.history.go(1) on the page prior to the page that i don't want the user to be able to click back on?

cheers.
john

--------------
:)
 
Well, just think about what that script does. If there's a position in the forward history of the user's browser, then it forwards them to it.

So if I'm on page2, and I click back to get back to page1, then page2 is in my forward history. So the script has to be on page1, and it will promptly send me right back (or forward) where I came from.

It's not a true disabling, but rather a little hack that effectively disables it.

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top