Reputation: 11
I am trying to maintain session in phonegap. When i change iframe url using javascript, user session automatically destroyed. Do you have any idea how to maintain session in phonegap while changing the iframe source.
Thanks
Upvotes: 0
Views: 318
Reputation: 1331
With local 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. Local 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.
Local storage is per origin (per domain and protocol). All pages, from one origin, can store and access the same data.here is the reference if you want to read in detail localStorage
localStorage.setItem("lastname", "Smith");
localStorage.getItem("lastname");
The sessionStorage property allows you to access a session Storage object. sessionStorage is similar to Window.localStorage, the only difference is while data stored in localStorage has no expiration set, data stored in sessionStorage gets cleared when the page session ends. A page session lasts for as long as the browser is open and survives over page reloads and restores. Opening a page in a new tab or window will cause a new session to be initiated, which differs from how session cookies work.
// Save data to sessionStorage
sessionStorage.setItem('key', 'value');
// Get saved data from sessionStorage
var data = sessionStorage.getItem('key');
// Remove saved data from sessionStorage
sessionStorage.removeItem('key')
here is the reference if you want to read in detail sessionStorage
Upvotes: 1