Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persistent storage on client side

Is there any way to have some persistent data (like an XML file or so) apart from cookies at client side? I know that's not possible with JavaScript directly. But any other way like Applets or something??

like image 490
mihsathe Avatar asked Nov 25 '10 15:11

mihsathe


People also ask

What is stored at client-side?

They are bits of text stored on the client machine and sent with the HTTP request to the Web site for which they were created. So, for example, if you created a user name to access your bank account this can be stored in a cookie and sent with the access request to the bank.

What is persistent storage in browser?

Persistent storage is any data storage device that retains data after power to that device is shut off. It is also sometimes referred to as nonvolatile storage.

How I store data in client-side in JS?

localStorage is similar to sessionStorage, except that while data stored in localStorage has no expiration time, data stored in sessionStorage gets cleared when the page session ends — that is, when the page is closed. As highlighted above: To store the data indefinitely (until the cache is cleared), use Window.


3 Answers

HTML5 local storage

like image 181
hvgotcodes Avatar answered Oct 06 '22 04:10

hvgotcodes


If cookies won't suffice, and you have to support older browsers, then LawnChair might help: http://brian.io/lawnchair/plugins/

It's like a "Couch" but smaller, get it? Took me a few minutes ;).

And, it does work for desktop browsers, despite the blurb on the site about mobile-webkit: https://github.com/brianleroux/lawnchair/blob/master/README.md.

(But, it uses cookies as the adapter to store data for the fallback on those older browsers, most such libraries probably will, if you're not allowed to use cookies for some reason, these types of libraries might not fit the bill.)

like image 30
Charlie Collins Avatar answered Oct 06 '22 06:10

Charlie Collins


The latest browsers are supporting HTML5 Local Storage.

If the client doesn't support HTML 5, the Google Gears plugin allows local storage.

like image 28
cspolton Avatar answered Oct 06 '22 06:10

cspolton