Skip to content

Instantly share code, notes, and snippets.

@damienalexandre
Created December 21, 2011 21:47
Show Gist options
  • Save damienalexandre/1507857 to your computer and use it in GitHub Desktop.
Save damienalexandre/1507857 to your computer and use it in GitHub Desktop.
Web Storage API
// Stocker une valeur
sessionStorage.setItem('key', 'value');
localStorage.setItem('key', 'value');
// Récupérer une valeur
var item = sessionStorage.getItem('key');
var item = localStorage.getItem('key');
// Supprimer une valeur
sessionStorage.removeItem('key');
localStorage.removeItem('key');
// Supprimer toutes les valeurs
sessionStorage.clear();
localStorage.clear();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment