views:

88

answers:

1

Given is a form that is followed by a confirmation page where you have to confirm you entered data of previous form. Now if the user refreshes this recapitulation page, the data form the previous form reposts. Is there a way to prevent that in JavaScript?

I know its not a ideal solution, it should happen on the server side. But i have no choice in this case.

+1  A: 

You can't prevent the user from reposting using javascript. This should be done server side using the redirect after post pattern.


UPDATE:

A possible but not robust solution is to simulate the redirect from javascript using window.location.href.

Darin Dimitrov
i know. But this is not an option here :( but +1 for the link i gonna send to the dev that is "not avalible" :/
meo
Then neither is what you're trying to do.
David M
I am afraid that's the only option. Also users might have javascript disabled. Using javascript you could probably redirect using `window.location.href` but once again this is not a robust solution.
Darin Dimitrov
i know its not robust. Really. For now i just gonna redirect the user on window.location.href. Once i can contact the dev i gonna send him your link. Could you just edit your answer, and add the "unrobust" js solution. So i can confirm your answer?
meo