«With web storage, web applications can store data locally within the user’s browser.
Before HTML5, application data had to be stored in cookies, included in every server request. Web storage is more secure, and large amounts of data can be stored locally, without affecting website performance. Unlike cookies, the storage limit is far larger (at least 5MB) and information is never transferred to the server.Web storage is per origin (per domain and protocol). All pages, from one origin, can store and access the same data.» [Quelle]
HTML web storage provides two objects for storing data on the client:
- window.localStorage – stores data with no expiration date
- window.sessionStorage – stores data for one session (data is lost when the browser tab is closed or the page ist reload) → Beispiel
The localStorage object stores the data with no expiration date. The data will not be deleted when the browser is closed, and will be available the next day, week, or year.
Click the Link to see the counter increase. Close the browser tab (or window), and try again, and the counter will continue to count – until you will delete the browsers history.
Anwendung:
SchülerInnen schreiben ihren Text in einem solcherart definierten div container (Textfeld) und bestimmen selbst, wie lang sie ihn behalten wollen.