Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Local Storage Example

Public visualization

Local Storage Example

0 stars0🌍 Public
Rralfz123
Last edited Nov 24, 2020
Created on Nov 24, 2020

This example demonstrates how a browser persists user input across page reloads using the Web Storage API. It shows a text field and button; entering a name and submitting it saves the value, which is then restored into the input field upon refreshing the page. The JavaScript code uses `window.localStorage`, `storage.getItem`, and `storage.setItem` to manage the stored data, and it appends a new paragraph element to the document body after each submission.

AI-generated description

A simple example showing how local storage works

Enter a name, press the button and reload the page. The name will be recovered from local storage.

Comments

Sign in to join the discussion.

MIT Licensed