-1

In Chrome whenever i try to refresh a page with button click i'm losing all the posted data on that page.

For e.g.

I navigate from Page 1 to Page 2 and pass some data to Page 2 from Page 1. Now when i refresh Page 2 with any of the following lines of the codes:

history.go(0);

OR

window.location.reload();

OR

window.location = window.location.href

After Page 2 is refreshed i loose all the data that i got from Page 1.

This is only happening in chrome. In Firefox and IE 8 after refreshing Page 2 it still has the data which i transferred from Page 1.

Can anyone please guide me on how can i refresh the page without losing the data. Thanks

Ariel
  • 25,995
  • 5
  • 59
  • 69
Viking
  • 127
  • 2
  • 13
  • lHow are you filling in the form data when the page opens? Do you have an `onload` function that gets the information from cookies or localStorage? If so, please show your code. – Barmar Jul 02 '14 at 20:26
  • some browsers by default may maintain the form's last state as a preference or feature. In the end, you may be seeing this because your own chrome settings are set to not do this. You should be storing them in a cookie or local storage as barmar alluded to. That way you can guarantee the same results for any browser (think chrome's form autofill and how it forces fields to be yellow) – Kai Qing Jul 02 '14 at 20:27

1 Answers1

0

Do you need to use POST data to load page 2? Try using URL Params to keep the state of your page.

index.html?var1=bla
  • he would still need to store the first form in local storage or cookies, or pass the get vars back to the first page – Kai Qing Jul 02 '14 at 21:00