News
IBM to offer mobile security as a service IBM will start delivering mobile security-as-a-service (MaaS) through its own cloud infrastructure in India, a move that is expected to better address in-country data requirements... IBM Spectrum Computing: IBM has enlarged its portfolio of software-defined infrastructure solutions with cognitive features for workload management.  * LiFi internet technology has been introduced, the new type of wireless internet connection that gives 100 times faster than traditional WiFi -- Invented by Professor Harald Haas from the University of Edinburgh. * Sci. Rachid Yazami has developed a smart chip that charges smartphones in less than 10 minutes. BenQ has launched BlueCore projector - Consumer electronics major BenQ has launched its first BlueCore laser light source projector. For those unaware, devices with BlueCore laser technology have a high contrast output of 80000:1 with an extended lamp life and efficiency. *** 
  Apr 6 2015 12:49AM     Anand
  0 Comments    1491 Views  
Here Anand gave such a good explanation about Session and Local Storage in HTML5
So what is HTML5 Storage? Simply put, it’s a way for web pages to store named key/value pairs locally, within the client web browser.
Like cookies, this data persists even after you navigate away from the web site, close your browser tab, exit your browser, or what have you. Unlike cookies, this data is never transmitted to the remote web server
Browser Supportablity
API Chrome Internet Explorer Firefox Safari Opera
Web Storage 4.0 8.0 3.5 4.0 11.5
Web storage provides far greater storage capacity (5 MB per origin in Google Chrome,[6] Mozilla Firefox,[7] and Opera; 10 MB per storage area in Internet Explorer
Only strings can be stored via the Storage API.[11] Attempting to store a different data type will result in an automatic conversion into a string in most browsers.
Web storage offers two different storage areas,
They are,
1) Local Storage
2) Session Storage
Local Storage
Store value on the browser Using Local Storage in HTML5.
Example
<script type="text/javascript">
localStorage.setItem('key''value');
alert(localStorage.getItem('key'));
</script> 
We can also store object in Local Storage but think we need to do is, stringify your object before storing it, and later parse it when you retrieve it
var testObject = { 'one': 1, 'two': 2, 'three': 3 };

// Put the object into storage
localStorage.setItem('testObject', JSON.stringify(testObject));

// Retrieve the object from storage
var retrievedObject = localStorage.getItem('testObject');

console.log('retrievedObject: ', JSON.parse(retrievedObject));
Session Storage
Store value on the browser beyond the duration of the session.
Example
// Store value on browser for duration of the session
sessionStorage.setItem('key', 'value');
 
// Retrieve value (gets deleted when browser is closed and re-opened)
alert(sessionStorage.getItem('key'));
Hi, This is Anand.I hope this page will helps you to understand Session and Local Storage In HTML5.Thanks
BackToTop
Comments



 
Search
Recent Posts
Create Amazon ElasticCache Using Memcached in CSharp
Oct 29 2018 12:09PM Posted By Amose
Get Google Map Lat Lng (Geo Point) By Pincode in C#
Oct 28 2018 12:09PM Posted By Pranav
Google URL Shortener in C#
Oct 20 2018 12:09PM Posted By Sanjay
Bind Gridview from CSV file in Asp.Net C#
Oct 5 2018 12:09PM Posted By Michael
Call WebService method from jQuery in every 1 minute
Sep 26 2018 12:09PM Posted By John
Gridview custom CSS in ASP.Net
Sep 14 2018 12:09PM Posted By Micheal Ryan
Read excel file and bind to Gridview in C#
Sep 10 2018 12:09PM Posted By Micheal
Tags
Follow us on Facebook
Follow us on Google +
Recent post in your Email inbox.
Enter your email address: