MulliGan MulliGan - 1 year ago 94
HTML Question

Resending POST data

I have below 2 questions regarding browser behavior.


  1. When we resend a form using browser's refresh button or F5 key, why does the browser send the post data again when such a behavior isn't desirable (adding to cart the same product again i.e.)?

  2. Why is the post data still being sent when I've clicked "clear your recent history" in FireFox?


Answer Source

After you do a POST request, browsers keep that information in memory in case they can send it again if you refresh the page. In your case you come from a POST request, so the browser will ask you if you want to send the POST data again, and you cant avoid that.

To avoid it you may add action to the form to a different page and process all the data there.

Or you can process the data on the same page and after processing all the data you can redirect to a new page.

hope this helps..

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download