javascript - JS page formatting is not retained when navigating away from a page and back -


i have bit of issue page formatting when navigate away, , hit browser page.

here example:

i have security questions on form in drop down list so:

http://i.stack.imgur.com/ib32z.jpg

when user selects [type in own question] drop down list, have jquery animates css change pushes form down, , makes visible hidden field 'custom security question'. when selected, form looks this: http://i.stack.imgur.com/uvpko.jpg

now dilemma when navigate away page, , navigate using browsers button, formatting gets screwed , looks this:

http://i.stack.imgur.com/5xhpi.jpg

the javascript have written not trigger again on button browser doesn't know move form down accomodate change in spacing. there anyway can force document.ready reload or clear kind of cache?

thanks!

edit: sorry guys, need reupload images host , repost. sorry delay.

there 4 mechanisms persisting state on web:

  1. browser-based - browser, if you're lucky, save answers form fields , re-display them when sees input same name; also, browsers preserve state between forward<=>back navigation
  2. cookie-based - pretty self-explanatory; save cookie state info, , check later recover state
  3. url-based - navigate different hash of url, info want in (eg. "?roll_down=true")
  4. html5/local storage - if you're interested :-)

we can throw 1 , 4 out, because both rely on browser behavior/support, , can't reliably rely on browsers handle them way want. leaves #2 or #3.

cookies allow save more info (as cookie holds, ie. 4k). urls allow less info, have added benefit of bookmark-ability; if user saves url bookmark (or link send friend, or whatever), state still gets preserved.

so, take pick of above, decide on how persist "my form rolled down" state ... , comes part (i think) you're interested in: how check state , fix things when user clicks "back"?

that part humbly defer post, has answered it: is there way catch button event in javascript?


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -