We need to implement a mechanism to persist information between web pages in the same session. There is a lot of information on the client-side and passing it back and forth to the server across requests is something we want to avoid. HTML5 local storage is one option.
The other option mentioned was “using a hidden frame where the data is kept”. I am not sure what this option really means.
- Does it mean keeping a hidden frame that holds on to the data across page requests?
- How would this be accomplished? Are there any jquery plugins or sample code I can look at?
- What are the advantages and disadvantages?
I am not aware of a way where you can keep data in the main page and use a hidden
iframe/frameto persist data. This is because once the main page is reloaded (when you go to another page), everything in the iframe is lost.You would basically use the main page as your data-storage location. On top of the main page, you would superimpose an
iframe. The user would interact with your site through theiframe. From the user’s perspective, there is no difference. You can persist information by writing to the parent frame (the main page). Since the main page is never getting reloaded, you can persist data inside it.I am not aware of any Javascript libraries that do this; I will take a look though.
Keep in mind that this might affect SEO and possibly navigation (not back/forward buttons). Another point, as Guffa noted, is that users cannot share links to your page since the URL in the address bar never changes (all interaction is via the
iframe). So when your user sends someone a link, they will end up at the very first page.