Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How can we add and remove data from local storage?

user-image
Question ajoutée par Faten Almajaly
Date de publication: 2015/03/24
Shahid Riaz Bhatti
par Shahid Riaz Bhatti , Principal Software Engineer (Team Lead) , Sunstar Technologies Pvt Ltd

Set data as follow:-

 

localStorage.setItem("Key", value);

 

and to get Item from local storage

 

localStorage.getItem("key");

 

Also check if browser supports local storage before using it. It will look something like this:-

 

if(Storage == undefined || typeOf(Storage) == "undefined")

{

alert("Storage is not supported")

}

else

{

// Get or Set Item

}

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?