TestProject Forum
Powered by leading experts in the test automation community

Get array of all variables in browser localStorage

I want to retrieve all localStorage variables into an array in javascript

Is there a method for this ?

var ls = [];

for (var i = 0; i < localStorage.length; i++){
    ls.push(localStorage.getItem(localStorage.key(i)));
}

Ahh… so it seems it has to be done manually

Thanks for the help!