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?
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.
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.
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.
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.
you can find an example on this page on hacks.mozilla.org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With