Click here to Skip to main content
15,890,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I'm facing an interesting issue, the 'localStorage' is not working in different master pages of same web application.

In my application I'm using 'localStorage' to remember the input given by user in a particular text-box (its inside the master page of logged-in user) and I'm trying to clear this "localStorage" upon next time the user log-in(this page using different master page- 'public user master page').

I'm not able to take/clear the localStorage from public user master page, which was set inside logged-in user's master page. Has the "localStorage" have any dependency on master pages? I'm using below code to set and clear localStorage.

C#
//sets the value
if (typeof  (Storage) != "undefined") {
    localStorage.UserInput = 'xxxx';
}

//clearing
localStorage.clear();


Any help will greatly appreciated.

Thanks,
Renjith
Posted
Updated 18-Sep-12 2:24am
v4

1 solution

I tried the following in the IE debugger console;

VB
>>localStorage["Dave"] = "Dave";
"Dave"
>>localStorage.Aproperty = "Dave";
"Dave"
>>localStorage["Dave"];
"Dave"
>>localStorage.Aproperty
"Dave"
>>localStorage.clear();
undefined
>>localStorage.Aproperty;
undefined
>>localStorage["Dave"];
undefined


works as expected..........

I know that this isn't an Answer, but it wouldn't look right as a comment.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900