perlrookie1 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I've got a bit of a doubt regarding how the browser behaves in a 'session-less' environment. I have got a page (A) where I let the user choose something of his/her choice using a form (POST method). Then once the form is submitted, based on his/her choice page B is displayed. There can be many links on page B which will be redirected to their corresponding pages along. I am also passing the choice as a parameter here. So if user selects the radio button '1' in page A, then B will get '1' as his choice and once the user clicks on any of the hyperlinks, say h, he/she will be taken to a page with URL like http://server/folder/h.cgi?choice=1. Based on this parameter this page will do some processing. But my question is, that if the user clicks on the browser's back button now from here, then what will happen? I have cleared the browser's cache after having arrived at the last page (link h) and then gone back to the previous page and if I click on any other link , say x, I found that the original choice is still there which is exactly what I want. But is it a guaranteed behavior? I want to make sure that once the user makes his choice in page A, user will be freed of the burden to make that choice again and after having clicked on any of the links on page B, user can come back to page B again, click on another link and be assured that his original choice is still there. Apologies for making it sound a little too complicated that what is :). Thanks in advance :).
  • Comment on Browser behavior in remembering parameters

Replies are listed 'Best First'.
Re: Browser behavior in remembering parameters
by Anonymous Monk on May 08, 2012 at 13:51 UTC
      That's what cookies are for? Why not just store all choices in a cookie and then update the cookie as necessary. That way no matter where they are, their choices are there, their pathways are preserved. You can detect if a browser doesn't take cookies. Also, the links should still be the same if they click back, because, in most cases the page is rendered from a local cache and not from the server.