Skip to main content
100%

Local Storage Example

✓ Published0🌍 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.

MIT Licensed

Similar vizzes