How can I show all the localStorage saved variables?

Ariel picture Ariel · Mar 23, 2011 · Viewed 74k times · Source

I want to acess all the localStorage variables saved on a specific page. How do I do that? I want to show it like I would show an array with the join() function

Answer

Greg picture Greg · Mar 23, 2011

You could try iterating through all of the items in the localStorage object:

for (var i = 0; i < localStorage.length; i++){
    // do something with localStorage.getItem(localStorage.key(i));
}