sessionStorage doesn't clear after clear() (localhost)

1.1k views Asked by At

Situation

I'm testing a website with db via localhost. I got 2 pages (for examples sake: index.aspx and other.aspx).

On index.aspx, I use sessionStorage to see if some data is cached, if not I fetch the date from the db.

If the user goes to other.aspx, the sessionStorage is always cleared using window.sessionStorage.clear();

If I use the dev tools (google chrome), I can see that the sessionStorage is empty after the clear(), but if I reload the page, or go to index.aspx, all the data is back again.

Code:

index.aspx:

if (typeof (Storage) == "undefined")
     return false;

var data = window.sessionStorage.getItem("importantInformation");
if (data != undefined && data != null)
    console.log("important information is here");

other.aspx:

window.sessionStorage.clear();

Desired result:

if I do a clear(), that the sessionStorage actually is empty.. As it should be.

0

There are 0 answers