Web APIs

Web Storage API

Checking compatibility...

Store data in the browser with the Web Storage API. Learn to use localStorage and sessionStorage for client-side data persistence.

localStorage

Remember user preferences and data even after the browser is closed. This example shows how to store information that persists between visits, perfect for saving user settings, shopping carts, or game progress.

=
=
=
=
=
=

Output

Click Run to see output...

sessionStorage

Store temporary information that's only needed while the user is on your site. This example demonstrates how to save data that automatically clears when the tab is closed, ideal for multi-step forms or temporary user states.

=
=
=
=
=
=

Output

Click Run to see output...