HTML Local Storage

Last Updated:

HTML Local Storage

The HTML Local Storage allows you to access and save data (key/value pairs) in a web browser.

Note: The properties of Local Storage as follows:

  • Unlike sessionStorage, the data stored in Local Storage has no expiration time, i.e., the data will NOT be deleted when the browser is closed, and will be available the next day, week, or year.
  • The keys and values are always strings.

How to view Local Storage?

Follow the below steps to view your data stored in the Local Storage:

  1. Go to Developer Tools or Press F12 or Press Ctrl + Shift + i.
  2. Switch to Application Tab on the top navigation bar.
  3. On the left side menu you will find the Local Storage.

Note: If you couldn't find your recent changes in the Session Storage, close and reopen the developer tools to see the changes.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <div id="point"></div> <script> var x = document.getElementById("point"); if(typeof(Storage) !== "undefined") { localStorage.setItem("website", "wikimass.com"); x.innerHTML = localStorage.getItem("website"); } else{ x.innerHTML = "Sorry, your browser does not support Web Storage"; } </script> </body> </html>

Browser Support

Devicedesktopmobile
Browsergoogle chromesafarifirefoxinternet Exploreredgeoperagoogle chromesafarifirefoxedgeoperaandroid webviewsamsung internet
Local storageYesYesYesYesYesYesYesYesYesYesYesYesYes

Share this Page

Meet the Author