views:

251

answers:

2

Hi,

I have a page with a few hidden fields in it. Those get filled with values by a script (JS/jQuery) when the user has finished selecting a couple of options.

Now, if I click a link on that page, go to the linked page and then hit the back-button, FF and Safari are able to read out the values of the hidden fields. So the function to read out the values seems to be correct (it's not complicated anyway).

But IE (and also Opera, even though I set history.navigationMode to compatible) shows me empty values, even though I can see the correct values in the generated sourcecode of IE.

I also added a test function, to show me the values onunload, which worked fine. But hitting the back-button IE still doesn't "recognize" them.

I have no idea what the problem here is. Anyone?

Thanks!

+1  A: 

You are relying on the browser filling the in correct form fields automatically when re-entering a form using the back button. AFAIK, only FF and Safari do this by default. Whether it can be activated in IE and other browsers, I don't know. Anyway, you can't rely on it in the wild.

You may have to work around this using Cookies. You would have to set cookie values onchange or onunload, and read out the cookie values when your page loads.

Pekka
+1  A: 

Actually, Firefox even keeps current values when hitting refresh, while IE resets page to initial values on refresh. I guess this is same stuff. No standards describe what should actually happen here, so you should not rely on how the different browsers choose to handle this scenario.

awe
north
.. or you can use Session....
awe