jquery - Javascript state is saved when using back button to get to page -


i using firefox, , have noticed interesting while working on website. 1 page has table of information, maintains javascript variables indicating table's contents can information more easily.

when navigate away page typing in url, hit button return, have noticed page seems retain state. table still has same contents when left, , further interactions page indicate javascript variables have maintained values well.

i had assumed $(document).ready(); functions run again when button hit, not case wrote functions ensure page initial state, regardless of page's current content.

i think acceptable page restored way long can depend on page being restored properly. if instead, page restored initial state, acceptable well.

is safe rely on behavior? better off using onunload ensure page's state not saved? should assume browser things properly?

i website's state defined html on page , contents of javascript variables. uses ajax (or guess technically ajaj) interact php pages, interactions discrete transactions. state/session needed server login authentication cookies, should unaffected this.