I'm just wondering how to get all key values in localStorage
.
I have tried to retrieve the values with a simple JavaScript loop
for (var i=1; i <= localStorage.length; i++) {
alert(localStorage.getItem(i))
}
But it works only if the keys are progressive numbers, starting at 1.
How do I get all the keys, in order to display all available data?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…