3 ms·
The problem with using cookies for navigation is then you restrict the user to a single window/tab. If the user opens a separate window and navigates somewhere
by cpburns2009 9y ago
The problem with using cookies for navigation is then you restrict the user to a single window/tab. If the user opens a separate window and navigates somewhere else in the application, the cookie state will reflect the new window and disregard the state from the previous one.
- ge96 9y agoSorry for the cookies I meant the storing of whatever you were writing into a form and accidentally hitting back or navigating away from the page. Like in mobile leaving the browser and returning to it, sometimes for me it starts it over haha no, just empty your soul into an essay response, all gone. Probably soared the recipient. Interesting about the separate window, thought cookies could be set to never expire.
- cpburns2009 9y agoOh, I see. For saving the form state, localStorage would work better than cookies for saving and restoring because then the information is only kept on the client. That still doesn't solve the multiple window problem, but that's likely less of an issue for a filling out a form than for navigation. Cookies can certainly be set to never expire, but you don't know which window the cookie was intended for because the cookies are shared.
- ge96 9y agoI wasn't aware. Are you talking like HTML5? Haven't used local storage before. Thanks for the info.
- cpburns2009 9y agoYes, see Window.localStorage [1] and this short guide [2]. [1]: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage https://developer.mozilla.org/en-US/docs/Web/API/Window/loca... [2]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage...
- ge96 9y agothanks for the references, I'd like to start using it at some point. Would be cool to check the client's device capabilities/run a specific event based on conditions met. I finally used memcache(d) so that's cool.