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!

Refresh webpage on back button

Status
Not open for further replies.

bigbird3156

Programmer
Feb 20, 2001
183
AU
Hi everyone,

I know that the answer is out there somewhere, have been searching for it but cant find the answer in any past threads...

I want to put in a javascript on a confirmation page that when the user presses the back button the page it goes to will refresh rather than just going back - there are fields on the previous page that I want to come up blank rather than have the information just typed for security reasons.

can anyone help?

[wiggle]The Bird from Down Under- Bigbird 3156
Programmer?? - I thought the option was pretender not programmer!![jester]
 
Hello bigbird! If you have all the fields in a form just use:

Code:
<body onload="formname.reset();">

Or does it have to be specifically on the back button?

Nick
 
yeah I need it on the back button, can you help?

[wiggle]The Bird from Down Under- Bigbird 3156
Programmer?? - I thought the option was pretender not programmer!![jester]
 
Add this to the <head> section of your page:
Code:
<meta http-equiv="cache-control" content="no-cache">



-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B> bites again.[/small]
 
I tried this with no luck it still loads the filled out fields when you go back to it

[wiggle]The Bird from Down Under- Bigbird 3156
Programmer?? - I thought the option was pretender not programmer!![jester]
 
Adam is likely correct that the page is cached from a previous load. Press CTRL+F5 on the page to get a nice fresh copy from the server and then test it out.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B> bites again.[/small]
 
tried that, still no luck - check it out at....


if you put in the name field that it is a test and put in a credit card number of 4111111111111111 then it will let the order go through...

once the "accepted" page comes up press back, and the fields are all still filled out.


[wiggle]The Bird from Down Under- Bigbird 3156
Programmer?? - I thought the option was pretender not programmer!![jester]
 
This is default browser behavior with firefox - I'm not sure about IE7 although I know that IE6 didn't used to do it. Other than asking the users to disable this option in their browser, the only thing I can think of to fix it would be to run a function once the page loads to clear all the fields. Unfortunately, this solution is not very elegant...

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B> bites again.[/small]
 
thanks anyway...

[wiggle]The Bird from Down Under- Bigbird 3156
Programmer?? - I thought the option was pretender not programmer!![jester]
 
BB, I've had a look at your site and dont see why you can't just do what I originally suggested?

If you have all the fields in a form just use:

Code:
<body onload="formname.reset();">

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top