AllInWorld99 provides a reference manual covering many aspects of web programming, including technologies such as HTML, XHTML, CSS, XML, JavaScript, PHP, ASP, SQL,FLASH, jQuery, java, for loop, switch case, if, if else, for...of, for...in, for...each,while loop, blogger tips, blogger meta tag generator, blogger tricks, blogger pagination, client side script, html code editor, javascript editor with instant output, css editor, online html editor, materialize css tutorial, materialize css dropdown list,break, continue statement, label,array, json, get day and month dropdown list using c# code, CSS button,protect cd or pendrive from virus, cordova, android example, html and css to make android app, html code play,telerik show hide column, Transparent image convertor, copy to clipboard using javascript without using any swf file, simple animation using css, SQL etc. AllInWorld99 presents thousands of code examples (accompanied with source code) which can be copied/downloaded independantly. By using the online editor provided,readers can edit the examples and execute the code experimentally.



Local storage and Session storage

  Local storage and session storage are part of web storage which itself is part of the HTML5 application.

Local storage and Session storage

Local Storage

     Stores data with no expiration date and this is the one we will be using because we want out to-do’s to stay on the page for as long as possible. 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 domain. All pages, from one domain, can store and access the same data.

Store

localStorage.setItem("lastname", "Smith");
Create a localStorage name/value pair with name="lastname" and value="Smith"

Retrieve

document.getElementById("result").innerHTML = localStorage.getItem("lastname");
Retrieve the value of "lastname" and insert it into the element with id="result"

Remove Item

localStorage.removeItem("lastname");
Remove the local storage "lastname" key

Session Storage
     It is same as the local storage except that it stores the data  for one session.The data is deleted when the user closes the browser window. The following is the example of using session storage.

Set  value

sessionStorage.setItem("Name","aaa");

Get value

sessionStorage.getItem("Name");


0 comments:

Post a Comment

Total Pageviews