V
ViLco
I'm using Ajax and I have pages with many input tags where user can insert
data. My js function edit some input tags as well, using
document.getElementById("elementname").value = myvalue
After having set data on page1 and clicking a button, a js function will
redirect the browser to page2 where the user will choose between an OK and a
Cancel button. The OK button calls a JS function that does some work and
then redirects the browser back to page1 via a history.back() command.
When this happens, in FF and IE8 the page page1 will show itself just as we
left it: with all of the data still in the input tags, since these browsers
cache the page when moving to another page and then, when getting back, they
show the page as they cached it.
In Safari and Chrome, instead, the history.back() command issues a *reload*
of the page from the server, so all of the input tags values get back to the
value they had before the user and JS function edited them. All user
inserted values are lost along with all the values I had programmatically
set in page1 via JS functions.
I need the data that was entered in page1, and I'm at a loss with these two
Webkit based browsers.
I searched the web and found many people talking about this issue, including
people who said they solved the issue in many ways: some suggest to use
history.go(-1) instead of history.back(), some suggest to use
history.back(1), others suggest to create a JS function goback() which does
a history.go(-1) and call that function instead of history.go(.1) directly,
but none of that works. I have seen that many of these persons talk about
anchors, like this:
<a href="#" onClick="history.go(-1)">go back</a>
This is not my case since I'm directing the browser back in a programmatical
way, which is: from my JS functions, not in an anchor like the above one.
Anyone has a clue about how to prevent this reload?
Chrome version: 14.0.835.202 (Official build 103287) m
Safari version: 5.1 (7534.50)
data. My js function edit some input tags as well, using
document.getElementById("elementname").value = myvalue
After having set data on page1 and clicking a button, a js function will
redirect the browser to page2 where the user will choose between an OK and a
Cancel button. The OK button calls a JS function that does some work and
then redirects the browser back to page1 via a history.back() command.
When this happens, in FF and IE8 the page page1 will show itself just as we
left it: with all of the data still in the input tags, since these browsers
cache the page when moving to another page and then, when getting back, they
show the page as they cached it.
In Safari and Chrome, instead, the history.back() command issues a *reload*
of the page from the server, so all of the input tags values get back to the
value they had before the user and JS function edited them. All user
inserted values are lost along with all the values I had programmatically
set in page1 via JS functions.
I need the data that was entered in page1, and I'm at a loss with these two
Webkit based browsers.
I searched the web and found many people talking about this issue, including
people who said they solved the issue in many ways: some suggest to use
history.go(-1) instead of history.back(), some suggest to use
history.back(1), others suggest to create a JS function goback() which does
a history.go(-1) and call that function instead of history.go(.1) directly,
but none of that works. I have seen that many of these persons talk about
anchors, like this:
<a href="#" onClick="history.go(-1)">go back</a>
This is not my case since I'm directing the browser back in a programmatical
way, which is: from my JS functions, not in an anchor like the above one.
Anyone has a clue about how to prevent this reload?
Chrome version: 14.0.835.202 (Official build 103287) m
Safari version: 5.1 (7534.50)