PDA

View Full Version : Remember dynamically changed HTML when Back:ing


coolberg
10-09-2007, 10:57 AM
I have a form which includes some radio buttons. Depending on which radio
button is pressed, a table of links is shown using dynamic HTML (innerHTML).
When a link is clicked on, the user is taken to another page. This works fine.
However, when the user then presses Back, the original page is re-displayed
with the selected radio button still pressed, but the dynamic HTML is
"forgotten". Is there any way (without using cookies) to make the browser
remember the dynamically changed HTML ? (I'm just talking about MSIE.)

I tried to solve it by saving the HTML string in a hidden FORM object, but the browser didn't remember the value of this object after returning to the page.
Strange; it did remember the radio button, but not this other value.

diades
10-10-2007, 04:22 PM
Hi

One easy way would be to add a simple command to the function that chenges the markup:
window.name = "My_choice_of_winow_name_here";

When a browser is loaded the page has no window name but, it is persistant! So, using the onload event-handler, check for the window name; if it returns an empty string do nothing if, however, it returns the value that you have given it then you are re-visiting the page and, the control had been triggered so, invoke the function that changes the markup in the onload function.

coolberg
10-11-2007, 08:53 AM
But I would still need to save the data that the markup will be changed to,
wouldn't I ? (Like in a cookie)

diades
10-11-2007, 09:36 AM
HI

But I would still need to save the data that the markup will be changed to,
wouldn't I ? (Like in a cookie)No, the markup was originally changed as a result of selecting a radio button. The function that causes that would be the one that is run onload of the document if the condition exists that it should do so.
I cannot, however, be more specific without seeing your page.

coolberg
10-11-2007, 10:06 AM
OK, I see. That's the way I finally solved it. I just thought there would be a way to make the web browser remember, or cache, the changed DOM.