Reputation: 1036
I have a simple application written in Visual Studio 2010.
The java script behind a button click:
function btnClicked() {
alert(localStorage["name"]);
localStorage["name"] = "Bill";
}
When I click it the first time, I get "undefined" and the second time I get "Bill", which is correct.
But if I restart the application, I'd hope it would display "Bill" the first time I click the button.
It doesn't. What am I missing?
Upvotes: 0
Views: 75
Reputation: 324650
But when I restart the application...
... you restart it. Which includes wiping any localStorage
contents. Try running your page in a browser and it should work just fine.
Upvotes: 1