Click here to Skip to main content
12,628,919 members (34,738 online)
Rate this:
 
Please Sign up or sign in to vote.
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.

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

Any help will greatly appreciated.

Thanks,
Renjith
Posted 9-Jul-12 5:31am
Updated 18-Sep-12 3:24am
v4

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I tried the following in the IE debugger console;

>>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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.161205.3 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100