Reputation: 28177
Is it possible to save the current state of a webpage so you can later restore it to that state?
Through "state" I mean everything that defines the current behavior of the page: html tags, css, JavaScript variables, form data, etc...
So you could simply have something like: savePage()
which stores all the needed data in localhost and then use loadPage()
to retrieve that data.
I guess the html
, css
and inputs value
are easy to save, but what about all the JavaScript variables on that page? Is it possible to save all the JavaScript variables held in the memory? (probably in a JSON
object).
Upvotes: 6
Views: 10108
Reputation: 17757
Essentially what you want is to resuse something when user comes back,so here is my answer.
well its certainly possible.You can traverse the dom and put your stuff in to localstorage.
LocalStorage supports only string.
Use localStorage if you want the data to persist beyond browser close and SessionStorage if i want the data to persist with in the browser close.
NOTE:IE7 + support for SessionStorage and LocalStorage
It has plenty of memory as compared to cookies(4kb with 15 to 20 cookies allowed per domain).
Upvotes: 3
Reputation: 99411
Well depends, you can use localStorage to do that on the client side, or for example write a javascript function to send all variables to the server and store them there.
You need to think more about that problem.
Upvotes: 0