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

    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 1.16k
    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
    

 0 Answer(s)

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: