Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Robert_C_6
New Contributor I
89 Views

Session Storage not clearing after each app restart

Jump to solution

I have a token that I am trying to store into session storage so that it is cleared after each time the app is restarted but the toke persists even after i close and reopen the simulator.

here is my code for the storage

  sessionStorage.setItem("url", "http://robbotdev.com");

 

 

Tags (2)
0 Kudos
1 Solution
Shahab_L_Intel
Employee
89 Views
 

I cannot reproduce this. When I close the simulator and reopen the data in sessionStorage is deleted.

To test this, I made a couple of small modifications to the blank html5 template project of the Intel XDK as follows:

In index.html

<p id="p1">Hello, Intel XDK!</p>
<button onclick="testFunction()"> Test </button>

In app.js

function testFunction() {
  var name = "none";
  if(sessionStorage.getItem("name")) {
    name = sessionStorage.getItem("name");
  }
  document.getElementById("p1").innerHTML= "Hello " + name;
  sessionStorage.setItem("name", "John");
}

The first time you click on the button it shows "Hello none", but in consequent calls it shows "Hello John". After closing and restarting the simulator, the first time it shows "Hello none" again.

View solution in original post

2 Replies
Shahab_L_Intel
Employee
90 Views
 

I cannot reproduce this. When I close the simulator and reopen the data in sessionStorage is deleted.

To test this, I made a couple of small modifications to the blank html5 template project of the Intel XDK as follows:

In index.html

<p id="p1">Hello, Intel XDK!</p>
<button onclick="testFunction()"> Test </button>

In app.js

function testFunction() {
  var name = "none";
  if(sessionStorage.getItem("name")) {
    name = sessionStorage.getItem("name");
  }
  document.getElementById("p1").innerHTML= "Hello " + name;
  sessionStorage.setItem("name", "John");
}

The first time you click on the button it shows "Hello none", but in consequent calls it shows "Hello John". After closing and restarting the simulator, the first time it shows "Hello none" again.

View solution in original post

Robert_C_6
New Contributor I
89 Views

Thanks for replaying Shahab! After I restarted the program this error seems to have gone away

Reply