Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

local storage and session storage [closed]

Tags:

html

jquery

I'm taking my first step of a thousand miles with the new local storage and session storage found in html5.

http://www.w3.org/TR/offline-webapps/

Q: Is there a code example of using either session storage or local storage, where the user enters a value, the value is saved locally, the user then connects to the Internet on his 56K modem and the local storage is synced with a server?

like image 488
Phillip Senn Avatar asked Feb 24 '10 17:02

Phillip Senn


People also ask

Is session storage same as local storage?

sessionStorage is similar to localStorage ; the difference is that while data in localStorage doesn't expire, data in sessionStorage is cleared when the page session ends. Whenever a document is loaded in a particular tab in the browser, a unique page session gets created and assigned to that particular tab.

Does local storage persist when browser is closed?

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.

How do I clear local storage when Windows is closed?

You can make use of the beforeunload event in JavaScript.onbeforeunload = function() { localStorage. removeItem(key); return ''; }; That will delete the key before the browser window/tab is closed and prompts you to confirm the close window/tab action.

Does session storage persist on tab close?

As the name suggests, session storage only persists the data as long as a browser tab is opened. This means that each time you open a new tab or a new browser window, a new session storage is created. So any data you store inside the session storage will automatically get deleted when you close that tab/window.


1 Answers

you can find an example on this page on hacks.mozilla.org

like image 174
futtta Avatar answered Nov 16 '22 01:11

futtta