My learning journal for Code Fellows
Reading 13 Local Storage
- Web doc http://diveinto.html5doctor.com/storage.html
Diving In
- What we want for storage is
- alot of storage space
- on the client
- that persists beyond a page refresh
- isnt transmitted to the server
- userData allows web pages to store up to 64kb of data per domain in XML based structure
HTML 5
- Refered to as locat storage or DOM storage by certian browsers
- Its a way for web pages to store named key/value pairs locally within the clients web browsers
- But unlike the regular cookies this data is never trasmitted to the remote web server
- It is implemented natively in web browsers so its available when third party plugins are not
- In JS code youll access HTML 5 storage though localstorage objects on the global windown objects
Using html5
- Based on named key/value pairs
- Store data on a named key than you can also retrieve that data with the same key, the named key is a string.
- If you are storing anything other than a string you will need to use a function
Limitations in current browsers
- 5 megabytes is the amount of storage space each origin recieves by default
- Storing lots of data like integers or flots the data storage amount adds up
- Over 5 megabytes you will get an error
Beyond named key-value pairs
- Due to the limitation of 5 megabytes other options have arrived
- SQL,SQL database provies a thin wrapper around SQL database allowing you to do things from JS
- The Indexed Database API, exposes an object store, still in the works