Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is HTML Local Storage?

    • 0
    • 0
    • 1
    • 5
    • 0
    • 0
    • 0
    • 279
    Answer it

    What is HTML Local Storage Objects ?

    Local Storage is that method we can store data on user browser. Its work same as cookies. Cookies was use in old time means before html5 and Local Storage is much better then it because we can store more data (max 5 MB) and this is more secure.

    Difference between local Storage object and sessionStorage ?

    With data stored in localStorage without expiration time and data stored with sessionStorage gets cleared when browsing session ends means when the browser will close.

    That is the only difference between local Storage object and sessionStorage.

    Advantage of HTML Local Storage

    1) They allow 5MB and cookies allow only 4 KB of data storage.
    2) It is more secure.
    3) Its not affecting website performance.
    4) All pages, from one origin, can store and access the same data.
    5) Its compatible with all browser.

    Using of Local Storage

    You have to do is modify the Local Storage object. You can do that directly use the setItem() and getItem() method:

    If you read out the favoritecar key, you will get back Ferrari -

    localStorage.setItem('favoritecar','Ferrari');
    // -> "Ferrari"
    

    To remove the item, you can use the removeItem() method -

    localStorage.removeItem('favoritecar');
    var carName= localStorage.getItem('favoritecar');
    // -> null
    

 5 Answer(s)

  • Thanks for your post! I think there are many other people who are interested in them just like me! How long does it take to complete this article? I have read through other blogs, but they are cumbersome and confusing. I hope you continue to have such quality articles to share! Good luck!
    io games
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: