Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript + HTML5 localstorage [closed]

So I'm searching for a good crash course on localstorage and interacting with it in Javascript. I want to build a to-do list webapp with some extra functionality but it would be just for 1 user. I don't want to mess with php/mysql and have the server doing anything. Links to tutorials would be best :-D

like image 204
Alai Avatar asked May 10 '10 04:05

Alai


People also ask

Is localStorage cleared on browser close?

localStorage is similar to sessionStorage , except that while localStorage data has no expiration time, sessionStorage data gets cleared when the page session ends — that is, when the page is closed.

Is localStorage always available?

localStorage is a property that allows JavaScript sites and apps to save key-value pairs in a web browser with no expiration date. This means the data stored in the browser will persist even after the browser window is closed.

Can localStorage be cleared?

Local Storage data will not get cleared even if you close the browser. Because it's stored on your browser cache in your machine. Local Storage data will only be cleared when you clear the browser cache using Control + Shift + Delete or Command + Shift + Delete (Mac)


2 Answers

Here's a crash crash course I found very useful. It explains a bunch of HTML5 concepts, including localStorage, video tag, offline websites, forms, locations, canvas, and more.

http://diveintohtml5.org/storage.html

like image 93
Steve Avatar answered Sep 20 '22 05:09

Steve


There is the offical documentation:

http://dev.w3.org/html5/webstorage/

For a quick demo with code: http://html5demos.com/storage also more html5 demos at the root of that site.

Note there are also things like the YUI 2 Storage Utility which abstract the storage for you (HTML 5, Google Gears, SWF) depending on what the browser supports:

The Storage Utility provides a mechanism for storing significant amounts of textual data, client-side, whether or not your browsers supports the proposed HTML 5 Storage specification.

like image 32
Peter McG Avatar answered Sep 22 '22 05:09

Peter McG