I have a page with javascript code that shows/hides some elements switching their display css property from 'none' to 'inline'.

Everything works as expected, except one thing: when the user follows a link and then hits the "back" button the page is back to the state it was when first loaded.

The browser forgets about the chage made by javascript to the markup.

Can anybody explain what's going on? And how do I prevent the browser from "resetting" the page each time the user navigates away?

1 answer

BPartch 342
1
point

You will have to set a cookie.

http://www.the-art-of-web.com/javascript/preferences/

Answered almost 7 years ago by BPartch